Skip to content

Commit

Permalink
feat(atoms): add css props to the GridLayout
Browse files Browse the repository at this point in the history
  • Loading branch information
ej9x committed Jul 9, 2018
1 parent df499de commit 6fcd43d
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion src/atoms/Grid/GridLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,20 @@ import { createStyledTag, createTheme } from 'utils';

type GridLayoutProps = {|
children?: React$Node,
/** possbile spaces between grid items */
gap?: 'xs' | 'md' | 'lg' | 'none',
/** when true then set inline-grid */
inline?: boolean,
padding?: 'xs' | 'md' | 'lg' | 'none',
/** possible offsets of the grid layout */
offset?: 'xs' | 'md' | 'lg' | 'none',
/** justify-content css rule*/
justifyContent?: 'start' | 'end' | 'center' | 'stretch' | 'space-around' | 'space-between' | 'space-evenly',
/** align-content css rule*/
alignContent?: 'start' | 'end' | 'center' | 'stretch' | 'space-around' | 'space-between' | 'space-evenly',
/** justify-items css rule */
justifyItems?: 'start' | 'end' | 'center' | 'stretch',
/** align-items css rule */
alignItems?: 'start' | 'end' | 'center' | 'stretch',
|};

const name = 'gridLayout';
Expand Down Expand Up @@ -65,6 +76,22 @@ const StyledTag = createStyledTag(name, (props) => {
style.gridTemplateAreas = props.areas.map((item) => `"${item.join(' ')}"`).join(' ');
}

if (props.justifyContent) {
style.justifyContent = props.justifyContent;
}

if (props.alignContent) {
style.alignContent = props.alignContent;
}

if (props.justifyItems) {
style.justifyItems = props.justifyItems;
}

if (props.alignItems) {
style.alignItems = props.alignItems;
}

return style;
});

Expand Down

0 comments on commit 6fcd43d

Please sign in to comment.