Skip to content

Commit e41c7c4

Browse files
committed
initial scaffolding and working draft
0 parents  commit e41c7c4

24 files changed

+18834
-0
lines changed

.babelrc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"presets": [
3+
"@babel/preset-env",
4+
"@babel/preset-react"
5+
],
6+
"plugins": [
7+
"@babel/plugin-proposal-class-properties"
8+
]
9+
}

.editorconfig

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
end_of_line = lf
10+
max_line_length = null

.eslintrc.js

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
module.exports = {
2+
parser: "babel-eslint",
3+
env: {
4+
browser: true,
5+
es6: true,
6+
},
7+
extends: 'airbnb',
8+
globals: {
9+
Atomics: 'readonly',
10+
SharedArrayBuffer: 'readonly',
11+
dataLayer: 'readonly',
12+
Munchkin: 'readonly'
13+
},
14+
parserOptions: {
15+
ecmaFeatures: {
16+
jsx: true,
17+
},
18+
ecmaVersion: 2018,
19+
sourceType: 'module',
20+
},
21+
plugins: [
22+
'react',
23+
],
24+
rules: {
25+
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
26+
"no-console": 0,
27+
"camelcase": 0,
28+
"arrow-body-style": 0,
29+
"jsx-a11y/anchor-is-valid": ["error", {
30+
"aspects": ["invalidHref", "preferButton"]
31+
}],
32+
"jsx-a11y/click-events-have-key-events": 0,
33+
"react/no-array-index-key": 0,
34+
"max-len": 0,
35+
"react/no-danger": 0,
36+
"react/no-did-update-set-state": 0,
37+
"object-curly-newline": 0,
38+
"import/prefer-default-export": 0,
39+
"no-throw-literal": 0,
40+
},
41+
};

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/node_modules
2+
.DS_Store

README.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# React CSS Grid
2+
3+
## Source Code
4+
5+
### Abstract
6+
7+
This project leverages React's Context API as well as the newly instituted CSS Grid Layout specification in a way that allows for an elegantly abstracted horizontal column system, complete with nested-column support.
8+
9+
### Component Composition
10+
11+
```javascript
12+
<GridProvider numberOfColumns={14} gutterSize={'10px' || 'columnWidth'}>
13+
<Row>
14+
<Column span={4}>
15+
<Row>
16+
<Column span={2} />
17+
<Column span={2} />
18+
</Row>
19+
</Column>
20+
<Column span={10} />
21+
</Row>
22+
</GridProvider>
23+
```
24+
25+
### Component Documentation
26+
27+
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.
28+
29+
[Grid Row](/src/Row/README.md)
30+
[Grid Column](/src/Column/README.md)
31+
[Grid Provider](/src/GridProvider/README.md)
32+
33+
## Environment
34+
35+
### Distribution
36+
37+
The entrypoint for the production bundle is `/dist/build.bundle.js`, as defined in `package.json`. Importing this project will return that bundle.
38+
39+
### Compilation and Transpilation
40+
41+
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.
42+
43+
- tldr: `npm run build`.
44+
45+
### Development
46+
47+
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. It then will spin up `webpack-dev-server`, which serves a compiled and transpiled build _in memory_, with hot-reloading enabled.
48+
49+
- tldr: `npm run dev`.

demo/App.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import React from 'react';
2+
import { Row, Column, GridProvider } from '../src';
3+
4+
// Testing may include:
5+
// - Changing the `gutterSize` from "columnWidth" to a static dimension, i.e. 10px
6+
// - Changing the numberOfColumns to various integers and adjusting the `span` props as necessary
7+
8+
const App = () => {
9+
return (
10+
<GridProvider numberOfColumns={14} gutterSize="10px">
11+
<Row>
12+
<Column span={4} style={{ backgroundColor: 'lightpink' }}>
13+
<Row>
14+
<Column span={2} style={{ backgroundColor: 'rgba(0, 0, 0, .15)' }}>
15+
<p>Nested Column</p>
16+
</Column>
17+
<Column span={2} style={{ backgroundColor: 'rgba(0, 0, 0, .15)' }}>
18+
<p>Nested Column</p>
19+
</Column>
20+
</Row>
21+
</Column>
22+
<Column span={10} style={{ backgroundColor: 'lightpink' }}>
23+
<p>Column</p>
24+
</Column>
25+
</Row>
26+
</GridProvider>
27+
)
28+
}
29+
30+
export default App;

demo/index.html

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<html>
2+
<head></head>
3+
<body>
4+
<noscript>Enable JavaScript</noscript>
5+
<div id="root"></div>
6+
</body>
7+
</html>

demo/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import React from 'react';
2+
import { render } from 'react-dom';
3+
import App from './app.js';
4+
5+
render(<App />, document.getElementById('root'));

dist/build.bundle.js

+14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)