How to use mjml-button - 2 common examples

To help you get started, we’ve selected a few mjml-button examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github homerjam / mjml-mailchimp / src / mc-button.js View on Github external
'mj-column': ['mc-button'],
  'mj-hero': ['mc-button'],
  'mc-button': [],
});

export default class McButton extends MjButton {
  static endingTag = true

  static allowedAttributes = {
    ...MjButton.allowedAttributes,
    'mc:edit': 'string',
    'mc:hideable': 'string',
  }

  static defaultAttributes = {
    ...MjButton.defaultAttributes,
    'mc:hideable': false
  }

  isHideable() {
    if (this.getAttribute('mc:hideable') !== false) {
      return true
    }

    return false
  }

  // MODIFIED from https://github.com/mjmlio/mjml/blob/master/packages/mjml-button/src/index.js
  render() {
    const tag = this.getAttribute('href') ? 'a' : 'p'

    return `
github homerjam / mjml-mailchimp / src / mc-button.js View on Github external
import MjButton from 'mjml-button'
import { BodyComponent } from 'mjml-core'
import { registerDependencies } from 'mjml-validator'

registerDependencies({
  'mj-column': ['mc-button'],
  'mj-hero': ['mc-button'],
  'mc-button': [],
});

export default class McButton extends MjButton {
  static endingTag = true

  static allowedAttributes = {
    ...MjButton.allowedAttributes,
    'mc:edit': 'string',
    'mc:hideable': 'string',
  }

  static defaultAttributes = {
    ...MjButton.defaultAttributes,
    'mc:hideable': false
  }

  isHideable() {
    if (this.getAttribute('mc:hideable') !== false) {
      return true
    }

    return false
  }

mjml-button

mjml-button

MIT
Latest version published 11 months ago

Package Health Score

85 / 100
Full package analysis

Similar packages