-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Divider] Add support for middle divider #13574
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
304bf75
[Divider] Add other dividers from spec
joshwooding 0d3c958
[Divider] Re-added inset property
joshwooding 3752b73
[docs] Updated Divider Docs
joshwooding eea3d22
[core] Increased Size Limit
joshwooding 1cd659c
let's merge
oliviertassinari 78f8ebf
a new demo
oliviertassinari File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,77 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { withStyles } from '@material-ui/core/styles'; | ||
import Chip from '@material-ui/core/Chip'; | ||
import Button from '@material-ui/core/Button'; | ||
import Grid from '@material-ui/core/Grid'; | ||
import Divider from '@material-ui/core/Divider'; | ||
import Typography from '@material-ui/core/Typography'; | ||
|
||
const styles = theme => ({ | ||
root: { | ||
width: '100%', | ||
maxWidth: 360, | ||
backgroundColor: theme.palette.background.paper, | ||
}, | ||
chip: { | ||
marginRight: theme.spacing.unit, | ||
}, | ||
section1: { | ||
margin: `${theme.spacing.unit * 3}px ${theme.spacing.unit * 2}px`, | ||
}, | ||
section2: { | ||
margin: theme.spacing.unit * 2, | ||
}, | ||
section3: { | ||
margin: `${theme.spacing.unit * 6}px ${theme.spacing.unit * 2}px ${theme.spacing.unit * 2}px`, | ||
}, | ||
}); | ||
|
||
function MiddleDividers(props) { | ||
const { classes } = props; | ||
return ( | ||
<div className={classes.root}> | ||
<div className={classes.section1}> | ||
<Grid container alignItems="center"> | ||
<Grid item xs> | ||
<Typography gutterBottom variant="h4"> | ||
Toothbrush | ||
</Typography> | ||
</Grid> | ||
<Grid item> | ||
<Typography gutterBottom variant="h6"> | ||
$4.50 | ||
</Typography> | ||
</Grid> | ||
</Grid> | ||
<Typography color="textSecondary"> | ||
Pinstriped cornflower blue cotton blouse takes you on a walk to the park or just down the | ||
hall. | ||
</Typography> | ||
</div> | ||
<Divider variant="middle" /> | ||
<div className={classes.section2}> | ||
<Typography gutterBottom variant="body1"> | ||
Select type | ||
</Typography> | ||
<div> | ||
<Chip className={classes.chip} label="Extra Soft" /> | ||
<Chip className={classes.chip} label="Soft" /> | ||
<Chip className={classes.chip} label="Medium" /> | ||
<Chip className={classes.chip} label="Hard" /> | ||
</div> | ||
</div> | ||
<div className={classes.section3}> | ||
<Button variant="contained" color="primary" fullWidth> | ||
Add to cart | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
MiddleDividers.propTypes = { | ||
classes: PropTypes.object.isRequired, | ||
}; | ||
|
||
export default withStyles(styles)(MiddleDividers); | ||
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,62 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { withStyles } from '@material-ui/core/styles'; | ||
import List from '@material-ui/core/List'; | ||
import ListItem from '@material-ui/core/ListItem'; | ||
import ListItemText from '@material-ui/core/ListItemText'; | ||
import Avatar from '@material-ui/core/Avatar'; | ||
import BeachAccessIcon from '@material-ui/icons/BeachAccess'; | ||
import Divider from '@material-ui/core/Divider'; | ||
import Typography from '@material-ui/core/Typography'; | ||
|
||
const styles = theme => ({ | ||
root: { | ||
width: '100%', | ||
maxWidth: 360, | ||
backgroundColor: theme.palette.background.paper, | ||
}, | ||
dividerFullWidth: { | ||
margin: `5px 0 0 ${theme.spacing.unit * 2}px`, | ||
}, | ||
dividerInset: { | ||
margin: `5px 0 0 ${theme.spacing.unit * 9}px`, | ||
}, | ||
}); | ||
|
||
function SubheaderDividers(props) { | ||
const { classes } = props; | ||
return ( | ||
<List className={classes.root}> | ||
<ListItem> | ||
<ListItemText primary="Photos" secondary="Jan 9, 2014" /> | ||
</ListItem> | ||
<Divider component="li" /> | ||
<li> | ||
<Typography className={classes.dividerFullWidth} color="textSecondary" variant="caption"> | ||
Divider | ||
</Typography> | ||
</li> | ||
<ListItem> | ||
<ListItemText primary="Work" secondary="Jan 7, 2014" /> | ||
</ListItem> | ||
<Divider component="li" variant="inset" /> | ||
<li> | ||
<Typography className={classes.dividerInset} color="textSecondary" variant="caption"> | ||
Leisure | ||
</Typography> | ||
</li> | ||
<ListItem> | ||
<Avatar> | ||
<BeachAccessIcon /> | ||
</Avatar> | ||
<ListItemText primary="Vacation" secondary="July 20, 2014" /> | ||
</ListItem> | ||
</List> | ||
); | ||
} | ||
oliviertassinari marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
SubheaderDividers.propTypes = { | ||
classes: PropTypes.object.isRequired, | ||
}; | ||
|
||
export default withStyles(styles)(SubheaderDividers); |
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we get a demo that's closer to the recommended use of middle dividers?
It doesn't have to be that detailed, just following the correct use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree