From cfc4fa952324c1970652401f18a51a6aab5e6a61 Mon Sep 17 00:00:00 2001 From: "johan@baboons.se" Date: Thu, 22 Mar 2018 14:42:53 +0100 Subject: [PATCH] Updates Column to support align attribute and default to 'left' --- packages/heml-elements/src/Column.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/heml-elements/src/Column.js b/packages/heml-elements/src/Column.js index a8afb68..7f04145 100644 --- a/packages/heml-elements/src/Column.js +++ b/packages/heml-elements/src/Column.js @@ -11,9 +11,9 @@ const { const breakpoint = 600 export default createElement('column', { - attrs: [ 'small', 'large' ], + attrs: [ 'small', 'large', 'align' ], parent: [ 'row' ], - defaultAttrs: { small: 12, large: 12 }, + defaultAttrs: { small: 12, large: 12, align: 'left' }, containsText: true, rules: { @@ -21,6 +21,7 @@ export default createElement('column', { }, render (attrs, contents) { + const { align } = attrs const small = parseInt(attrs.small, 10) const large = parseInt(attrs.large, 10) const largeWidth = `${Math.round((100 * large) / 12)}%` @@ -28,9 +29,10 @@ export default createElement('column', { delete attrs.large delete attrs.small + delete attrs.align return ([ - + {contents.length === 0 ? ' ' : contents} , small === large ? '' : (