Skip to content

Commit

Permalink
Fixed ColProps and, col props implementation when false are pas…
Browse files Browse the repository at this point in the history
…sed.
  • Loading branch information
strozw committed Jan 17, 2022
1 parent 09ea4eb commit b46291d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/system/src/styles/flexbox-grids.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ describe('#flexboxGrids', () => {
flex: '0 0 33.3333%',
})

expect(flexboxGrids({ col: false })).toEqual({})

expect(flexboxGrids({ col: true })).toEqual({
boxSizing: 'border-box',
flexBasis: 0,
Expand Down
6 changes: 5 additions & 1 deletion packages/system/src/styles/flexbox-grids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const getColStyle = (
}

export interface ColProps<T extends ITheme = Theme> {
col?: SystemProp<true | 'auto' | string | number, T>
col?: SystemProp<true | 'auto', T>
}
export const col = createStyleGenerator<ColProps>({
getStyle: (props) => {
Expand All @@ -59,6 +59,10 @@ export const col = createStyleGenerator<ColProps>({
maxWidth: '100%',
}

if (value === false) {
return null
}

if (obj(value)) {
const breakpointsStyle = reduceVariants(
props,
Expand Down

0 comments on commit b46291d

Please sign in to comment.