How to use the mjml-core/lib/helpers.widthParser function in mjml-core

To help you get started, we’ve selected a few mjml-core 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 mjmlio / mjml / packages / mjml-divider / src / index.js View on Github external
outlookWidth () {
    const { mjAttribute } = this.props
    const parentWidth = parseInt(mjAttribute('parentWidth'))
    const {width, unit} = widthParser(mjAttribute('width'))

    switch (unit) {
      case '%': {
        return parentWidth * width / 100
      }
      default: {
        return width
      }
    }
  }