Skip to content
This repository was archived by the owner on Mar 1, 2024. It is now read-only.

Commit a2a2e75

Browse files
authored
Merge pull request #266 from tabler/grid-offsets
feat(GridCol): add offset props
2 parents 67802d3 + d6cb1f4 commit a2a2e75

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

src/components/Grid/GridCol.examples.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,16 @@
4949
</Grid.Col>
5050
</Grid.Row>
5151
```
52+
53+
### Column Offset
54+
55+
```jsx
56+
<Grid.Row>
57+
<Grid.Col width={6} offset={3}>
58+
2
59+
</Grid.Col>
60+
<Grid.Col md={6} offsetMd={3}>
61+
4
62+
</Grid.Col>
63+
</Grid.Row>
64+
```

src/components/Grid/GridCol.react.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ type Props = {|
1818
+xl?: number,
1919
+xlAuto?: boolean,
2020
+auto?: boolean,
21+
+offset?: number,
22+
+offsetXs?: number,
23+
+offsetSm?: number,
24+
+offsetMd?: number,
25+
+offsetLg?: number,
26+
+offsetXl?: number,
2127
|};
2228

2329
function GridCol({
@@ -35,6 +41,12 @@ function GridCol({
3541
lgAuto,
3642
xlAuto,
3743
auto,
44+
offset = 0,
45+
offsetXs = 0,
46+
offsetSm = 0,
47+
offsetMd = 0,
48+
offsetLg = 0,
49+
offsetXl = 0,
3850
}: Props): React.Node {
3951
const classes = cn(
4052
{
@@ -51,6 +63,12 @@ function GridCol({
5163
[`col-xl-${xl}`]: xl,
5264
[`col-xl-auto`]: xlAuto,
5365
"col-auto": auto,
66+
[`offset-${offset}`]: offset,
67+
[`offset-xs-${offsetXs}`]: offsetXs,
68+
[`offset-sm-${offsetSm}`]: offsetSm,
69+
[`offset-md-${offsetMd}`]: offsetMd,
70+
[`offset-lg-${offsetLg}`]: offsetLg,
71+
[`offset-xl-${offsetXl}`]: offsetXl,
5472
},
5573
className
5674
);

0 commit comments

Comments
 (0)