-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Chip] Add size prop for small option (#15751)
Co-Authored-By: Olivier Tassinari <[email protected]>
- Loading branch information
1 parent
0ffe293
commit b3cace6
Showing
10 changed files
with
707 additions
and
23 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,134 @@ | ||
import React from 'react'; | ||
import { makeStyles } from '@material-ui/core/styles'; | ||
import Avatar from '@material-ui/core/Avatar'; | ||
import Chip from '@material-ui/core/Chip'; | ||
import FaceIcon from '@material-ui/icons/Face'; | ||
import DoneIcon from '@material-ui/icons/Done'; | ||
|
||
const useStyles = makeStyles(theme => ({ | ||
root: { | ||
display: 'flex', | ||
justifyContent: 'center', | ||
flexWrap: 'wrap', | ||
}, | ||
chip: { | ||
margin: theme.spacing(1), | ||
}, | ||
})); | ||
|
||
function SmallChips() { | ||
const classes = useStyles(); | ||
|
||
function handleDelete() { | ||
alert('You clicked the delete icon.'); | ||
} | ||
|
||
function handleClick() { | ||
alert('You clicked the Chip.'); | ||
} | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<Chip size="small" label="Basic Chip" className={classes.chip} /> | ||
<Chip | ||
size="small" | ||
avatar={<Avatar>MB</Avatar>} | ||
label="Clickable Chip" | ||
onClick={handleClick} | ||
className={classes.chip} | ||
/> | ||
<Chip | ||
size="small" | ||
avatar={<Avatar alt="Natacha" src="/static/images/avatar/1.jpg" />} | ||
label="Deletable Chip" | ||
onDelete={handleDelete} | ||
className={classes.chip} | ||
/> | ||
<Chip | ||
size="small" | ||
avatar={ | ||
<Avatar> | ||
<FaceIcon /> | ||
</Avatar> | ||
} | ||
label="Clickable Deletable Chip" | ||
onClick={handleClick} | ||
onDelete={handleDelete} | ||
className={classes.chip} | ||
/> | ||
<Chip | ||
size="small" | ||
icon={<FaceIcon />} | ||
label="Clickable Deletable Chip" | ||
onClick={handleClick} | ||
onDelete={handleDelete} | ||
className={classes.chip} | ||
/> | ||
<Chip | ||
size="small" | ||
label="Custom delete icon Chip" | ||
onClick={handleClick} | ||
onDelete={handleDelete} | ||
className={classes.chip} | ||
deleteIcon={<DoneIcon />} | ||
/> | ||
<Chip | ||
size="small" | ||
label="Clickable Link Chip" | ||
className={classes.chip} | ||
component="a" | ||
href="#chip" | ||
clickable | ||
/> | ||
<Chip | ||
size="small" | ||
avatar={<Avatar>MB</Avatar>} | ||
label="Primary Clickable Chip" | ||
clickable | ||
className={classes.chip} | ||
color="primary" | ||
onDelete={handleDelete} | ||
deleteIcon={<DoneIcon />} | ||
/> | ||
<Chip | ||
size="small" | ||
icon={<FaceIcon />} | ||
label="Primary Clickable Chip" | ||
clickable | ||
className={classes.chip} | ||
color="primary" | ||
onDelete={handleDelete} | ||
deleteIcon={<DoneIcon />} | ||
/> | ||
<Chip | ||
size="small" | ||
label="Deletable Primary Chip" | ||
onDelete={handleDelete} | ||
className={classes.chip} | ||
color="primary" | ||
/> | ||
<Chip | ||
size="small" | ||
avatar={ | ||
<Avatar> | ||
<FaceIcon /> | ||
</Avatar> | ||
} | ||
label="Deletable Secondary Chip" | ||
onDelete={handleDelete} | ||
className={classes.chip} | ||
color="secondary" | ||
/> | ||
<Chip | ||
size="small" | ||
icon={<FaceIcon />} | ||
label="Deletable Secondary Chip" | ||
onDelete={handleDelete} | ||
className={classes.chip} | ||
color="secondary" | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
export default SmallChips; |
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,136 @@ | ||
import React from 'react'; | ||
import { createStyles, Theme, makeStyles } from '@material-ui/core/styles'; | ||
import Avatar from '@material-ui/core/Avatar'; | ||
import Chip from '@material-ui/core/Chip'; | ||
import FaceIcon from '@material-ui/icons/Face'; | ||
import DoneIcon from '@material-ui/icons/Done'; | ||
|
||
const useStyles = makeStyles((theme: Theme) => | ||
createStyles({ | ||
root: { | ||
display: 'flex', | ||
justifyContent: 'center', | ||
flexWrap: 'wrap', | ||
}, | ||
chip: { | ||
margin: theme.spacing(1), | ||
}, | ||
}), | ||
); | ||
|
||
function SmallChips() { | ||
const classes = useStyles(); | ||
|
||
function handleDelete() { | ||
alert('You clicked the delete icon.'); | ||
} | ||
|
||
function handleClick() { | ||
alert('You clicked the Chip.'); | ||
} | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<Chip size="small" label="Basic Chip" className={classes.chip} /> | ||
<Chip | ||
size="small" | ||
avatar={<Avatar>MB</Avatar>} | ||
label="Clickable Chip" | ||
onClick={handleClick} | ||
className={classes.chip} | ||
/> | ||
<Chip | ||
size="small" | ||
avatar={<Avatar alt="Natacha" src="/static/images/avatar/1.jpg" />} | ||
label="Deletable Chip" | ||
onDelete={handleDelete} | ||
className={classes.chip} | ||
/> | ||
<Chip | ||
size="small" | ||
avatar={ | ||
<Avatar> | ||
<FaceIcon /> | ||
</Avatar> | ||
} | ||
label="Clickable Deletable Chip" | ||
onClick={handleClick} | ||
onDelete={handleDelete} | ||
className={classes.chip} | ||
/> | ||
<Chip | ||
size="small" | ||
icon={<FaceIcon />} | ||
label="Clickable Deletable Chip" | ||
onClick={handleClick} | ||
onDelete={handleDelete} | ||
className={classes.chip} | ||
/> | ||
<Chip | ||
size="small" | ||
label="Custom delete icon Chip" | ||
onClick={handleClick} | ||
onDelete={handleDelete} | ||
className={classes.chip} | ||
deleteIcon={<DoneIcon />} | ||
/> | ||
<Chip | ||
size="small" | ||
label="Clickable Link Chip" | ||
className={classes.chip} | ||
component="a" | ||
href="#chip" | ||
clickable | ||
/> | ||
<Chip | ||
size="small" | ||
avatar={<Avatar>MB</Avatar>} | ||
label="Primary Clickable Chip" | ||
clickable | ||
className={classes.chip} | ||
color="primary" | ||
onDelete={handleDelete} | ||
deleteIcon={<DoneIcon />} | ||
/> | ||
<Chip | ||
size="small" | ||
icon={<FaceIcon />} | ||
label="Primary Clickable Chip" | ||
clickable | ||
className={classes.chip} | ||
color="primary" | ||
onDelete={handleDelete} | ||
deleteIcon={<DoneIcon />} | ||
/> | ||
<Chip | ||
size="small" | ||
label="Deletable Primary Chip" | ||
onDelete={handleDelete} | ||
className={classes.chip} | ||
color="primary" | ||
/> | ||
<Chip | ||
size="small" | ||
avatar={ | ||
<Avatar> | ||
<FaceIcon /> | ||
</Avatar> | ||
} | ||
label="Deletable Secondary Chip" | ||
onDelete={handleDelete} | ||
className={classes.chip} | ||
color="secondary" | ||
/> | ||
<Chip | ||
size="small" | ||
icon={<FaceIcon />} | ||
label="Deletable Secondary Chip" | ||
onDelete={handleDelete} | ||
className={classes.chip} | ||
color="secondary" | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
export default SmallChips; |
Oops, something went wrong.