File tree 4 files changed +3082
-526
lines changed
4 files changed +3082
-526
lines changed Original file line number Diff line number Diff line change 47
47
* ` columns ` : The [ grid-template-columns] CSS property. When a number is passed
48
48
it is a shorthand to specify the number of columns. Default is ` 12 ` .
49
49
* ` gap ` : The [ grid-gap] CSS property. Default is ` "8px" ` .
50
+ * ` columnGap ` : The [ column-gap] CSS property. Not provided by default.
51
+ * ` rowGap ` : The [ row-gap] CSS property. Not provided by default.
50
52
* ` minRowHeight ` : Minimum height of each row. Default is ` "20px" ` .
51
53
* ` height ` : The [ height] CSS property. Default is ` "auto" ` .
52
54
* ` flow ` : The [ grid-auto-flow] CSS property. Default is ` "row" ` .
@@ -92,6 +94,8 @@ You can use CSS grid _soon_ if you have to support the latest version of modern
92
94
[ grid-area ] : https://mdn.io/grid-area
93
95
[ height ] : https://mdn.io/css-height
94
96
[ grid-gap ] : https://mdn.io/grid-gap
97
+ [ column-gap ] : https://mdn.io/column-gap
98
+ [ row-gap ] : https://mdn.io/row-gap
95
99
[ justify-content ] : https://mdn.io/justify-content
96
100
[ align-content ] : https://mdn.io/align-content
97
101
[ caniuse ] : http://caniuse.com/#feat=css-grid
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ const Grid = styled.div`
20
20
${ ( { rows } ) => rows && `grid-template-rows: ${ frGetter ( rows ) } ` } ;
21
21
grid-template-columns: ${ ( { columns = 12 } ) => frGetter ( columns ) } ;
22
22
grid-gap: ${ gap } ;
23
+ ${ ( { columnGap } ) => columnGap && `column-gap: ${ columnGap } ` } ;
24
+ ${ ( { rowGap } ) => rowGap && `row-gap: ${ rowGap } ` } ;
23
25
${ ( { areas } ) => areas && `grid-template-areas: ${ formatAreas ( areas ) } ` } ;
24
26
${ ( { justifyContent } ) =>
25
27
justifyContent && `justify-content: ${ justifyContent } ` } ;
@@ -30,6 +32,8 @@ Grid.propTypes = {
30
32
className : PropTypes . string ,
31
33
columns : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . number ] ) ,
32
34
gap : PropTypes . string ,
35
+ columnGap : PropTypes . string ,
36
+ rowGap : PropTypes . string ,
33
37
height : PropTypes . string ,
34
38
minRowHeight : PropTypes . string ,
35
39
flow : PropTypes . string ,
Original file line number Diff line number Diff line change @@ -40,6 +40,16 @@ describe("<Grid />", () => {
40
40
expect ( tree ) . toHaveStyleRule ( "grid-gap" , "7px" ) ;
41
41
} ) ;
42
42
43
+ test ( "'columnGap' prop sets 'column-gap'" , ( ) => {
44
+ const tree = renderer . create ( < Grid columnGap = "7px" /> ) . toJSON ( ) ;
45
+ expect ( tree ) . toHaveStyleRule ( "column-gap" , "7px" ) ;
46
+ } ) ;
47
+
48
+ test ( "'rowGap' prop sets 'row-gap'" , ( ) => {
49
+ const tree = renderer . create ( < Grid rowGap = "7px" /> ) . toJSON ( ) ;
50
+ expect ( tree ) . toHaveStyleRule ( "row-gap" , "7px" ) ;
51
+ } ) ;
52
+
43
53
test ( "'minRowHeight' prop sets 'grid-auto-rows'" , ( ) => {
44
54
const tree = renderer . create ( < Grid minRowHeight = "7px" /> ) . toJSON ( ) ;
45
55
expect ( tree ) . toHaveStyleRule ( "grid-auto-rows" , "minmax(7px,auto)" ) ;
You can’t perform that action at this time.
0 commit comments