Skip to content
This repository was archived by the owner on Jun 20, 2022. It is now read-only.

Commit 0133098

Browse files
committed
feat: add gutter to grid
1 parent fb57171 commit 0133098

File tree

3 files changed

+11
-26
lines changed

3 files changed

+11
-26
lines changed

docs/Grid.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ Using `xs`, `sm`, `md`, `lg` and `xl` you can set size using responsive breakpoi
44

55
```js
66
<Row>
7-
<Col xs>1</Col>
8-
<Col xs>2</Col>
7+
<Col xs style={{ border: '1px solid black' }}>
8+
1
9+
</Col>
10+
<Col xs style={{ border: '1px solid black' }}>
11+
2
12+
</Col>
913
</Row>
1014
```

src/Col.js

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ function generateBreakPoint(breakpoint) {
4949
`
5050
}
5151

52-
const addProp = (propName, attribute, transform = x => x) => props =>
53-
typeof props[propName] !== 'undefined'
54-
? css`
55-
${attribute || propName}: ${transform(props[propName])};
56-
`
57-
: null
58-
5952
const ColComponent = ({ className, xs, sm, md, lg, xl, ...props }) => (
6053
<div
6154
className={classNames(
@@ -74,24 +67,14 @@ const ColComponent = ({ className, xs, sm, md, lg, xl, ...props }) => (
7467
},
7568
className,
7669
)}
77-
{...omit(props, [
78-
'theme',
79-
'alignItems',
80-
'alignContent',
81-
'alignSelf',
82-
'justifyContent',
83-
])}
70+
{...omit(props, ['theme'])}
8471
/>
8572
)
8673

8774
/** @component */
8875
const Col = styled(handleRef(ColComponent))`
89-
display: flex;
90-
91-
${addProp('alignItems', 'align-items')};
92-
${addProp('alignContent', 'align-content')};
93-
${addProp('alignSelf', 'align-self')};
94-
${addProp('justifyContent', 'justify-content')};
76+
padding-left: 15px;
77+
padding-right: 15px;
9578
${props => Object.keys(props.theme.breakPoints).map(generateBreakPoint)};
9679
`
9780

@@ -101,10 +84,6 @@ Col.propTypes = {
10184
md: PropTypes.oneOfType([PropTypes.bool, PropTypes.string, PropTypes.number]),
10285
lg: PropTypes.oneOfType([PropTypes.bool, PropTypes.string, PropTypes.number]),
10386
xl: PropTypes.oneOfType([PropTypes.bool, PropTypes.string, PropTypes.number]),
104-
alignItems: PropTypes.string,
105-
alignContent: PropTypes.string,
106-
alignSelf: PropTypes.string,
107-
justifyContent: PropTypes.string,
10887
}
10988

11089
Col.defaultProps = {

src/Row.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ const Row = styled(RowComponent)`
1010
flex-grow: 1;
1111
flex-wrap: wrap;
1212
display: flex;
13+
margin-right: -15px;
14+
margin-left: -15px;
1315
`
1416

1517
/** @component */

0 commit comments

Comments
 (0)