Skip to content

Commit 5dd5df2

Browse files
committed
revises README and demo
1 parent db6f6fb commit 5dd5df2

File tree

6 files changed

+648
-401
lines changed

6 files changed

+648
-401
lines changed

README.md

+69-66
Original file line numberDiff line numberDiff line change
@@ -3,83 +3,86 @@
33

44
# React CSS Grid
55

6-
## Abstract
6+
A pleasingly simple-to-use horizontal grid system for React based on [CSS Grid Layout](https://www.w3.org/TR/css-grid-1/), complete with breakpoints and nested-grid support.
77

8-
This project leverages React's Context API with the CSS Grid Layout specification in a way that allows for a pleasingly simple-to-use horizontal grid system, complete with breakpoints and nested-grid support.
8+
## Quick Start
99

10-
## Component Composition
10+
### Installation
1111

12-
```jsx
13-
<GridProvider
14-
hGap="columnWidth"
15-
vGap="10px"
16-
breakpoints={{
17-
xs: 350,
18-
s: 576,
19-
m: 768,
20-
l: 992,
21-
xl: 1200,
22-
}}
23-
classPrefix="demo"
24-
scopeCSSTo="#grid-demo"
25-
>
26-
<div id="grid-demo">
27-
<Grid>
28-
<Cell
29-
hStart={2}
30-
hSpan={4}
31-
hStartL={1}
32-
hSpanS={6}
33-
>
34-
<Grid>
35-
<Cell
36-
hSpan={2}
37-
hSpanS={3}
38-
>
39-
...
40-
</Cell>
41-
<Cell
42-
hSpan={2}
43-
hSpanS={3}
44-
>
45-
...
46-
</Cell>
47-
</Grid>
48-
</Cell>
49-
<Cell
50-
hSpan={8}
51-
hSpanL={9}
52-
hSpanS={8}
53-
>
54-
...
55-
</Cell>
56-
</Grid>
57-
</div>
58-
</GridProvider>
12+
```bash
13+
$ yarn add @trbl/react-css-grid
5914
```
6015

61-
## Component Documentation
62-
63-
The source components in their raw form are found in the `src` directory. These are all batch exported from the top-level `index.js` so that they can be easily accessed via import.
64-
65-
- [Grid ](/src/Grid/README.md)
66-
- [Cell](/src/Cell/README.md)
67-
- [Grid Provider](/src/GridProvider/README.md)
16+
### Compositon
6817

69-
## Environment
18+
```jsx
19+
import React from 'react';
20+
import { GridProvider, Grid, Cell } from '@trbl/react-css-grid';
21+
22+
const App = () => {
23+
return (
24+
<GridProvider
25+
hCount={12}
26+
hGap="columnWidth"
27+
vGap="10px"
28+
breakpoints={{
29+
xs: 350,
30+
s: 576,
31+
m: 768,
32+
l: 992,
33+
xl: 1200,
34+
}}
35+
>
36+
<Grid>
37+
<Cell hSpan={6}>
38+
...
39+
</Cell>
40+
<Cell
41+
hSpan={10}
42+
hStart={2}
43+
hSpanL={12}
44+
hStartL={1}
45+
hSpanS={6}
46+
>
47+
<Grid>
48+
<Cell
49+
hSpan={5}
50+
hSpanL={6}
51+
>
52+
...
53+
</Cell>
54+
<Cell
55+
hSpan={5}
56+
hSpanL={6}
57+
>
58+
...
59+
</Cell>
60+
</Grid>
61+
</Cell>
62+
</Grid>
63+
</GridProvider>
64+
)
65+
}
66+
```
7067

71-
### Distribution
68+
## Demo
7269

73-
The entrypoint for the production bundle is `/dist/build.bundle.js`, as defined in `package.json`. Importing this project will return that bundle.
70+
To demo locally, clone the repo and
7471

75-
### Compilation and Transpilation
72+
```bash
73+
$ yarn install
74+
$ npm run dev
75+
$ open http://localhost:3000
76+
```
7677

77-
Generating this production bundle is defined in `webpack.production.config.js`, one of two custom webpack configurations defined at the top of this repo. It simply processes all of the `.js` files within the `src` directory through the `babel-loader` transpiler and into the `dist` directory.
78+
## Documentation
7879

79-
- tldr: `npm run build`
80+
All available props can be found via the references below:
8081

81-
### Development
82+
- [Grid](/src/Grid/README.md)
83+
- [Cell](/src/Cell/README.md)
84+
- [Grid Provider](/src/GridProvider/README.md)
8285

83-
The other webpack configuration is `webpack.development.config.js` which does a few things differently -- compilation happens from the `demo` directory as opposed to the `src` directory directly. It then will spin up `webpack-dev-server`, which serves a compiled and transpiled build _in memory_, with hot-reloading enabled.
86+
## License
8487

85-
- tldr: `npm run dev`
88+
[MIT](https://github.com/trbldesign/react-css-grid/blob/master/LICENSE) Copyright (c) TRBL, LLC

demo/App.demo.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ const App = () => {
77
return (
88
<Fragment>
99
<div style={{ border: '1px solid', padding: '10px', marginBottom: '10px' }}>
10-
<GridDemo3 />
10+
<GridDemo1 />
1111
</div>
1212
<div style={{ border: '1px solid', padding: '10px', marginBottom: '10px' }}>
13-
<GridDemo1 />
13+
<GridDemo2 />
1414
</div>
1515
<div style={{ border: '1px solid', padding: '10px' }}>
16-
<GridDemo2 />
16+
<GridDemo3 />
1717
</div>
1818
</Fragment>
1919
);

0 commit comments

Comments
 (0)