Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getMobileWidth () {
const { mjAttribute, sibling, parentWidth, mobileWidth } = this.props
const width = mjAttribute('width')
if (mobileWidth != "mobileWidth" ) {
return '100%'
} else if (width == undefined) {
return `${parseInt(100 / sibling)}%`
}
const { width: parsedWidth, unit } = helpers.widthParser(width)
switch (unit) {
case '%':
return width
case 'px':
default:
return `${parsedWidth / parentWidth}%`
}
}
getColumnClass () {
const { mjAttribute, sibling } = this.props
const width = mjAttribute('width')
if (width == undefined) {
return `mj-column-per-${parseInt(100 / sibling)}`
}
const { width: parsedWidth, unit } = helpers.widthParser(width)
switch (unit) {
case '%':
return `mj-column-per-${parsedWidth}`
case 'px':
default:
return `mj-column-px-${parsedWidth}`
}
}
uniq(columnWidths).forEach((width) => {
const { width: parsedWidth } = helpers.widthParser(width, { parseFloatToInt: false })
const mediaQueryClass = `${className}-${parseInt(parsedWidth)}`
mediaQueries.push(`.${mediaQueryClass} { width:${parsedWidth}${unit}!important; }`)
})
})
getColumnClass () {
const { mjAttribute, sibling } = this.props
const width = mjAttribute('width')
if (width == undefined) {
return `mj-column-per-${parseInt(100 / sibling)}`
}
const { width: parsedWidth, unit } = helpers.widthParser(width)
switch (unit) {
case '%':
return `mj-column-per-${parsedWidth}`
case 'px':
default:
return `mj-column-px-${parsedWidth}`
}
}
render () {
const { renderWrappedOutlookChildren, mjAttribute, children } = this.props
const { width } = helpers.widthParser(mjAttribute('width'))
return (
<div style="{this.styles.div}" data-width="{width}" data-background-color="{mjAttribute('background-color')}">
{renderWrappedOutlookChildren(children)}
</div>
)
}