Skip to content

Commit 1a98a38

Browse files
authored
feat: support grid-gap row/columns (#39)
1 parent 2b55baa commit 1a98a38

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Props:
4646

4747
* `columns`: The [grid-template-columns] CSS property. When a number is passed
4848
it is a shorthand to specify the number of columns. Default is `12`.
49-
* `gap`: Gap between cells. Default is `"8px"`.
49+
* `gap`: The [grid-gap] CSS property. Default is `"8px"`.
5050
* `minRowHeight`: Minimum height of each row. Default is `"20px"`.
5151
* `flow`: The [grid-auto-flow] CSS property. Default is `"row"`.
5252
* `rows`: The [grid-template-rows] CSS property. When a number is passed
@@ -89,6 +89,7 @@ You can use CSS grid _soon_ if you have to support the latest version of modern
8989
[grid-template-rows]: https://mdn.io/grid-template-rows
9090
[grid-template-areas]: https://mdn.io/grid-template-areas
9191
[grid-area]: https://mdn.io/grid-area
92+
[grid-gap]: https://mdn.io/grid-gap
9293
[justify-content]: https://mdn.io/justify-content
9394
[align-content]: https://mdn.io/align-content
9495
[caniuse]: http://caniuse.com/#feat=css-grid

lib/Grid.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const autoRows = ({ minRowHeight = "20px" }) => `minmax(${minRowHeight}, auto)`;
66
const frGetter = value =>
77
typeof value === "number" ? `repeat(${value}, 1fr)` : value;
88

9-
const gap = ({ gap = "8px" }) => `${gap} ${gap}`;
9+
const gap = ({ gap = "8px" }) => gap;
1010

1111
const flow = ({ flow = "row" }) => flow;
1212

lib/__tests__/Grid.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe("<Grid />", () => {
3737

3838
test("'gap' prop sets 'grid-gap'", () => {
3939
const tree = renderer.create(<Grid gap="7px" />).toJSON();
40-
expect(tree).toHaveStyleRule("grid-gap", "7px 7px");
40+
expect(tree).toHaveStyleRule("grid-gap", "7px");
4141
});
4242

4343
test("'minRowHeight' prop sets 'grid-auto-rows'", () => {

lib/__tests__/__snapshots__/Grid.test.js.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ exports[`<Grid /> matches snapshot with default args 1`] = `
66
grid-auto-flow: row;
77
grid-auto-rows: minmax(20px,auto);
88
grid-template-columns: repeat(12,1fr);
9-
grid-gap: 8px 8px;
9+
grid-gap: 8px;
1010
}
1111
1212
<div

0 commit comments

Comments
 (0)