Skip to content

Commit

Permalink
fix: allow getShorthandAttrValue to parse borders (#2729)
Browse files Browse the repository at this point in the history
* fix: allow getShorthandAttrValue to parse borders

* Updated column to use getShorthandBorderValue
  • Loading branch information
garrettjohnson authored Sep 11, 2023
1 parent a61b973 commit 50cd15b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/mjml-column/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export default class MjColumn extends BodyComponent {
const { nonRawSiblings } = this.props
const { borders, paddings } = this.getBoxWidths()
const innerBorders =
this.getShorthandAttrValue('inner-border', 'left') +
this.getShorthandAttrValue('inner-border', 'right')
this.getShorthandBorderValue('left', 'inner-border') +
this.getShorthandBorderValue('right', 'inner-border')

const allPaddings = paddings + borders + innerBorders

Expand Down
6 changes: 3 additions & 3 deletions packages/mjml-core/src/createComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ export class BodyComponent extends Component {
return shorthandParser(mjAttribute, direction)
}

getShorthandBorderValue(direction) {
getShorthandBorderValue(direction, attribute = 'border') {
const borderDirection =
direction && this.getAttribute(`border-${direction}`)
const border = this.getAttribute('border')
direction && this.getAttribute(`${attribute}-${direction}`)
const border = this.getAttribute(attribute)

return borderParser(borderDirection || border || '0')
}
Expand Down

0 comments on commit 50cd15b

Please sign in to comment.