-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Grid] Document the nested capability (#12313)
- Loading branch information
1 parent
ca47fbf
commit a2c6937
Showing
6 changed files
with
169 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { withStyles } from '@material-ui/core/styles'; | ||
import Grid from '@material-ui/core/Grid'; | ||
import Paper from '@material-ui/core/Paper'; | ||
import Typography from '@material-ui/core/Typography'; | ||
import ButtonBase from '@material-ui/core/ButtonBase'; | ||
|
||
const styles = theme => ({ | ||
root: { | ||
flexGrow: 1, | ||
maxWidth: 600, | ||
padding: theme.spacing.unit * 2, | ||
}, | ||
image: { | ||
width: 128, | ||
height: 128, | ||
}, | ||
img: { | ||
margin: 'auto', | ||
display: 'block', | ||
maxWidth: '100%', | ||
maxHeight: '100%', | ||
}, | ||
}); | ||
|
||
function ComplexGrid(props) { | ||
const { classes } = props; | ||
return ( | ||
<Paper className={classes.root}> | ||
<Grid container spacing={16}> | ||
<Grid item> | ||
<ButtonBase className={classes.image}> | ||
<img className={classes.img} alt="complex" src="/static/images/grid/complex.jpg" /> | ||
</ButtonBase> | ||
</Grid> | ||
<Grid item xs={12} sm container> | ||
<Grid item xs container direction="column" spacing={16}> | ||
<Grid item xs> | ||
<Typography gutterBottom variant="subheading"> | ||
Standard license | ||
</Typography> | ||
<Typography gutterBottom>Full resolution 1920x1080 • JPEG</Typography> | ||
<Typography color="textSecondary">ID: 1030114</Typography> | ||
</Grid> | ||
<Grid item> | ||
<Typography style={{ cursor: 'pointer' }}>Remove</Typography> | ||
</Grid> | ||
</Grid> | ||
<Grid item> | ||
<Typography variant="subheading">$19.00</Typography> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
</Paper> | ||
); | ||
} | ||
|
||
ComplexGrid.propTypes = { | ||
classes: PropTypes.object.isRequired, | ||
}; | ||
|
||
export default withStyles(styles)(ComplexGrid); |
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,64 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { withStyles } from '@material-ui/core/styles'; | ||
import Paper from '@material-ui/core/Paper'; | ||
import Grid from '@material-ui/core/Grid'; | ||
|
||
const styles = theme => ({ | ||
root: { | ||
flexGrow: 1, | ||
}, | ||
paper: { | ||
padding: theme.spacing.unit, | ||
textAlign: 'center', | ||
color: theme.palette.text.secondary, | ||
}, | ||
}); | ||
|
||
function FormRow(props) { | ||
const { classes } = props; | ||
|
||
return ( | ||
<React.Fragment> | ||
<Grid item xs={4}> | ||
<Paper className={classes.paper}>item</Paper> | ||
</Grid> | ||
<Grid item xs={4}> | ||
<Paper className={classes.paper}>item</Paper> | ||
</Grid> | ||
<Grid item xs={4}> | ||
<Paper className={classes.paper}>item</Paper> | ||
</Grid> | ||
</React.Fragment> | ||
); | ||
} | ||
|
||
FormRow.propTypes = { | ||
classes: PropTypes.object.isRequired, | ||
}; | ||
|
||
function NestedGrid(props) { | ||
const { classes } = props; | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<Grid container spacing={8}> | ||
<Grid item xs={12} container spacing={24}> | ||
<FormRow classes={classes} /> | ||
</Grid> | ||
<Grid item xs={12} container spacing={24}> | ||
<FormRow classes={classes} /> | ||
</Grid> | ||
<Grid item xs={12} container spacing={24}> | ||
<FormRow classes={classes} /> | ||
</Grid> | ||
</Grid> | ||
</div> | ||
); | ||
} | ||
|
||
NestedGrid.propTypes = { | ||
classes: PropTypes.object.isRequired, | ||
}; | ||
|
||
export default withStyles(styles)(NestedGrid); |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.