Skip to content

Commit

Permalink
Merge pull request #1179 from cozy/feat/Grid
Browse files Browse the repository at this point in the history
feat: Add Grid system
Crash-- authored Oct 1, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 4afc9aa + 14feb45 commit 5ee244b
Showing 6 changed files with 100 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/styleguide.config.js
Original file line number Diff line number Diff line change
@@ -112,7 +112,8 @@ module.exports = {
'../react/MuiCozyTheme/Menus',
'../react/MuiCozyTheme/List',
'../react/MuiCozyTheme/RaisedList',
'../react/MuiCozyTheme/ExpansionPanel'
'../react/MuiCozyTheme/ExpansionPanel',
'../react/MuiCozyTheme/Grid'
]
}
],
71 changes: 71 additions & 0 deletions react/MuiCozyTheme/Grid/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Grid

Displays a Grid of items

### Default usage

```
const MuiCozyTheme = require('..').default;
const Grid = require('.').default;
const Card = require('../../Card').default;
<MuiCozyTheme>
<Grid container spacing={24}>
<Grid item xs={12}>
<Card>Homer Simpson</Card>
</Grid>
<Grid item xs={6}>
<Card>Homer Simpson</Card>
</Grid>
<Grid item xs={6}>
<Card>Homer Simpson</Card>
</Grid>
<Grid item xs={3}>
<Card>Homer Simpson</Card>
</Grid>
<Grid item xs={3}>
<Card>Homer Simpson</Card>
</Grid>
<Grid item xs={3}>
<Card>Homer Simpson</Card>
</Grid>
<Grid item xs={3}>
<Card>Homer Simpson</Card>
</Grid>
</Grid>
</MuiCozyTheme>
```

### Responsive usage

```
const MuiCozyTheme = require('..').default;
const Grid = require('.').default;
const Card = require('../../Card').default;
<MuiCozyTheme>
<Grid container spacing={8}>
<Grid item xs={12}>
<Card>Homer Simpson</Card>
</Grid>
<Grid item xs={12} sm={6}>
<Card>Homer Simpson</Card>
</Grid>
<Grid item xs={12} sm={6}>
<Card>Homer Simpson</Card>
</Grid>
<Grid item xs={3} sm={2}>
<Card>Homer Simpson</Card>
</Grid>
<Grid item xs={3} sm={2}>
<Card>Homer Simpson</Card>
</Grid>
<Grid item xs={3} sm={2}>
<Card>Homer Simpson</Card>
</Grid>
<Grid item xs={3} sm={2}>
<Card>Homer Simpson</Card>
</Grid>
</Grid>
</MuiCozyTheme>
```
3 changes: 3 additions & 0 deletions react/MuiCozyTheme/Grid/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Grid from '@material-ui/core/Grid'

export default Grid
19 changes: 19 additions & 0 deletions react/MuiCozyTheme/theme.js
Original file line number Diff line number Diff line change
@@ -173,6 +173,25 @@ export const theme = createMuiTheme({
paddingRight: 24
}
}
},
breakpoints: {
// Define custom breakpoint values.
// These will apply to Material-UI components that use responsive
// breakpoints, such as `Grid` and `Hidden`. You can also use the
// theme breakpoint functions `up`, `down`, and `between` to create
// media queries for these breakpoints
// xs = all
// sm = tiny
// md = small
// lg = medium
// xl = large
values: {
xs: 0,
sm: 480,
md: 768,
lg: 1023,
xl: 1200
}
}
})

4 changes: 4 additions & 0 deletions react/__snapshots__/examples.spec.jsx.snap
Original file line number Diff line number Diff line change
@@ -3295,6 +3295,10 @@ exports[`MuiCozyTheme/ExpansionPanel should render examples: MuiCozyTheme/Expans
exports[`MuiCozyTheme/ExpansionPanel should render examples: MuiCozyTheme/ExpansionPanel 2`] = `"<div></div>"`;
exports[`MuiCozyTheme/Grid should render examples: MuiCozyTheme/Grid 1`] = `"<div></div>"`;
exports[`MuiCozyTheme/Grid should render examples: MuiCozyTheme/Grid 2`] = `"<div></div>"`;
exports[`MuiCozyTheme/List should render examples: MuiCozyTheme/List 1`] = `"<div></div>"`;
exports[`MuiCozyTheme/List should render examples: MuiCozyTheme/List 2`] = `"<div></div>"`;
1 change: 1 addition & 0 deletions react/examples.spec.jsx
Original file line number Diff line number Diff line change
@@ -41,6 +41,7 @@ testComponent('MuiCozyTheme/Buttons')
testComponent('MuiCozyTheme/ExpansionPanel')
testComponent('MuiCozyTheme/List')
testComponent('MuiCozyTheme/Menus')
testComponent('MuiCozyTheme/Grid')
testComponent('Radio')
testComponent('SelectBox')
testComponent('Sidebar')

0 comments on commit 5ee244b

Please sign in to comment.