Skip to content

Commit a6a529f

Browse files
committed
Completing the examples
1 parent 018987f commit a6a529f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1572
-34389
lines changed

README.md

Lines changed: 82 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,50 @@ Demo: https://trendmicro-frontend.github.io/react-grid-system
1414
npm install --save react @trendmicro/react-grid-system
1515
```
1616

17-
2. Install [react-grid-system](https://github.com/trendmicro-frontend/react-grid-system) with <b>@trendmicro</b> scope:
17+
2. At this point you can import `@trendmicro/react-grid-system` and its styles in your application as follows:
1818

1919
```js
20-
import { Provider, Container, Row, Col } from '@trendmicro/react-grid-system';
20+
import {
21+
Provider as GridSystemProvider,
22+
Container,
23+
Row,
24+
Col
25+
} from '@trendmicro/react-grid-system';
26+
27+
// Be sure to include styles at some point, probably during your bootstraping
28+
import '@trendmicro/react-grid-system/dist/react-grid-system.css';
2129
```
2230

31+
## Recommended Setup
32+
33+
Create a common components directory including the GridSystem component, as shown below:
34+
```
35+
components/
36+
GridSystem/
37+
index.js
38+
```
39+
40+
**components/GridSystem/index.js**
41+
```jsx
42+
import '@trendmicro/react-grid-system/dist/react-grid-system.css';
43+
export {
44+
Provider,
45+
Container,
46+
Row,
47+
Col
48+
} from '@trendmicro/react-grid-system';
49+
```
50+
51+
Then, import components like below:
52+
```jsx
53+
import {
54+
Provider as GridSystemProvider,
55+
Container,
56+
Row,
57+
Col
58+
} from './components/GridSystem';
59+
```
60+
2361
## Usage
2462

2563
```jsx
@@ -40,6 +78,34 @@ Demo: https://trendmicro-frontend.github.io/react-grid-system
4078
</Container>
4179
```
4280

81+
### Provider
82+
83+
You can wrap `<Container />`, `<Row />`, and `<Col />` in `<Provider />` to pass grid system config through context.
84+
85+
```jsx
86+
<Provider
87+
breakpoints={[576, 768, 992, 1200]}
88+
containerWidths={[540, 720, 960, 1140]}
89+
columns={12}
90+
gutterWidth={20}
91+
layout="flexbox"
92+
>
93+
<Container>
94+
<Row>
95+
<Col>col</Col>
96+
<Col>col</Col>
97+
<Col>col</Col>
98+
</Row>
99+
</Container>
100+
<Container>
101+
<Row>
102+
<Col>col</Col>
103+
<Col>col</Col>
104+
</Row>
105+
</Container>
106+
</Provider>
107+
```
108+
43109
## API
44110

45111
### Properties
@@ -48,11 +114,11 @@ Demo: https://trendmicro-frontend.github.io/react-grid-system
48114

49115
Name | Type | Default | Description
50116
:--- | :--- | :------ | :----------
51-
breakpoints | Number[] | [576, 768, 992, 1200, 1600] | The breakpoints (minimum width) of devices in screen class sm, md, lg, xl, and xxl.
117+
breakpoints | Number[] | [576, 768, 992, 1200, 0] | The breakpoints (minimum width) of devices in screen class sm, md, lg, xl, and xxl.
52118
containerWidths | Number[] | [540, 720, 960, 1140, 0] | The container widths in pixels of devices in screen class sm, md, lg, xl, and xxl.
53-
columns | Number | 12 | The number of columns. Defaults to 12.
119+
columns | Number | 12 | The number of columns.
54120
gutterWidth | Number | 30 | The horizontal padding (called gutter) between two columns. A gutter width of 30 means 15px on each side of a column.
55-
layout | One of:<br>'float'<br>'flex' | 'float' | The grid system layout.
121+
layout | One of:<br>'floats'<br>'flexbox' | 'floats' | The grid system layout.
56122

57123
#### Container
58124

@@ -65,29 +131,30 @@ md | Boolean | false | True makes container fluid only in md, not present means
65131
lg | Boolean | false | True makes container fluid only in lg, not present means fluid everywhere.
66132
xl | Boolean | false | True makes container fluid only in xl, not present means fluid everywhere.
67133
xxl | Boolean | false | True makes container fluid only in xxl, not present means fluid everywhere.
134+
columns | Number | 12 | The number of columns.
68135
gutterWidth | Number | 30 | The horizontal padding (called gutter) between two columns. A gutter width of 30 means 15px on each side of a column.
69-
layout | One of:<br>'float'<br>'flex' | 'float' | The grid system layout.
136+
layout | One of:<br>'floats'<br>'flexbox' | 'floats' | The grid system layout.
70137
onResize | Function({ screenClass }) | | A callback fired when the resize event occurs.
71138

72139
#### Row
73140

74141
Name | Type | Default | Description
75142
:--- | :--- | :------ | :----------
143+
columns | Number | 12 | The number of columns.
76144
gutterWidth | Number | 30 | The horizontal padding (called gutter) between two columns. A gutter width of 30 means 15px on each side of a column.
77-
layout | One of:<br>'float'<br>'flex' | 'float' | The grid system layout.
78-
145+
layout | One of:<br>'floats'<br>'flexbox' | 'floats' | The grid system layout.
79146

80147
#### Col
81148

82149
Name | Type | Default | Description
83150
:--- | :--- | :------ | :----------
84-
width | Number | | The width of the column for all screen classes.
85-
xs | Boolean or Number | | The width of the column for screen class `xs`.
86-
sm | Boolean or Number | | The width of the column for screen class `sm`.
87-
md | Boolean or Number | | The width of the column for screen class `md`.
88-
lg | Boolean or Number | | The width of the column for screen class `lg`.
89-
xl | Boolean or Number | | The width of the column for screen class `xl`.
90-
xxl | Boolean or Number | | The width of the column for screen class `xxl`.
151+
width | Number or 'auto' | | The width of the column for all screen classes.
152+
xs | Boolean, Number or 'auto' | | The width of the column for screen class `xs`.
153+
sm | Boolean, Number or 'auto' | | The width of the column for screen class `sm`.
154+
md | Boolean, Number or 'auto' | | The width of the column for screen class `md`.
155+
lg | Boolean, Number or 'auto' | | The width of the column for screen class `lg`.
156+
xl | Boolean, Number or 'auto' | | The width of the column for screen class `xl`.
157+
xxl | Boolean, Number or 'auto' | | The width of the column for screen class `xxl`.
91158
offset | { xs, sm, md, lg, xl, xxl } | | The offset of this column for all screen classes.
92159
pull | { xs, sm, md, lg, xl, xxl } | | The amount this column is pulled to the left for all screen classes.
93160
push | { xs, sm, md, lg, xl, xxl } | | The amount this column is pushed to the right for all screen classes.

dist/react-grid-system.css

Lines changed: 76 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-grid-system.css.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-grid-system.min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)