forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] Add CSSGrid comparison example (mui#10433)
* [docs] Add CSSGrid comparison example * add flexbox
- Loading branch information
1 parent
e0a8fbd
commit ea179a1
Showing
4 changed files
with
135 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { withStyles } from 'material-ui/styles'; | ||
import Typography from 'material-ui/Typography'; | ||
import Paper from 'material-ui/Paper'; | ||
import Divider from 'material-ui/Divider'; | ||
import Grid from 'material-ui/Grid'; | ||
|
||
const styles = theme => ({ | ||
container: { | ||
display: 'grid', | ||
gridTemplateColumns: 'repeat(12, 1fr)', | ||
gridGap: `${theme.spacing.unit * 3}px`, | ||
}, | ||
paper: { | ||
padding: theme.spacing.unit, | ||
textAlign: 'center', | ||
color: theme.palette.text.secondary, | ||
whiteSpace: 'nowrap', | ||
marginBottom: theme.spacing.unit, | ||
}, | ||
divider: { | ||
margin: `${theme.spacing.unit * 2}px 0`, | ||
}, | ||
}); | ||
|
||
function CSSGrid(props) { | ||
const { classes } = props; | ||
|
||
return ( | ||
<div> | ||
<Typography variant="subheading" gutterBottom> | ||
Material-UI Grid: | ||
</Typography> | ||
<Grid container spacing={24}> | ||
<Grid item xs={3}> | ||
<Paper className={classes.paper}>xs=3</Paper> | ||
</Grid> | ||
<Grid item xs={3}> | ||
<Paper className={classes.paper}>xs=3</Paper> | ||
</Grid> | ||
<Grid item xs={3}> | ||
<Paper className={classes.paper}>xs=3</Paper> | ||
</Grid> | ||
<Grid item xs={3}> | ||
<Paper className={classes.paper}>xs=3</Paper> | ||
</Grid> | ||
<Grid item xs={8}> | ||
<Paper className={classes.paper}>xs=8</Paper> | ||
</Grid> | ||
<Grid item xs={4}> | ||
<Paper className={classes.paper}>xs=4</Paper> | ||
</Grid> | ||
</Grid> | ||
<Divider className={classes.divider} /> | ||
<Typography variant="subheading" gutterBottom> | ||
CSS Grid Layout: | ||
</Typography> | ||
<div className={classes.container}> | ||
<div style={{ gridColumnEnd: 'span 3' }}> | ||
<Paper className={classes.paper}>xs=3</Paper> | ||
</div> | ||
<div style={{ gridColumnEnd: 'span 3' }}> | ||
<Paper className={classes.paper}>xs=3</Paper> | ||
</div> | ||
<div style={{ gridColumnEnd: 'span 3' }}> | ||
<Paper className={classes.paper}>xs=3</Paper> | ||
</div> | ||
<div style={{ gridColumnEnd: 'span 3' }}> | ||
<Paper className={classes.paper}>xs=3</Paper> | ||
</div> | ||
<div style={{ gridColumnEnd: 'span 8' }}> | ||
<Paper className={classes.paper}>xs=8</Paper> | ||
</div> | ||
<div style={{ gridColumnEnd: 'span 4' }}> | ||
<Paper className={classes.paper}>xs=4</Paper> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
CSSGrid.propTypes = { | ||
classes: PropTypes.object.isRequired, | ||
}; | ||
|
||
export default withStyles(styles)(CSSGrid); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters