-
-
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.
- Loading branch information
1 parent
e3f8bf9
commit 5b3fb6b
Showing
19 changed files
with
405 additions
and
416 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 |
---|---|---|
@@ -1,16 +1,79 @@ | ||
import React from 'react'; | ||
import Badge from '@material-ui/core/Badge'; | ||
import Avatar from '@material-ui/core/Avatar'; | ||
import { makeStyles, withStyles } from '@material-ui/core/styles'; | ||
|
||
const StyledBadge = withStyles(theme => ({ | ||
badge: { | ||
backgroundColor: '#44b700', | ||
color: '#44b700', | ||
boxShadow: `0 0 0 2px ${theme.palette.background.paper}`, | ||
'&::after': { | ||
position: 'absolute', | ||
top: 0, | ||
left: 0, | ||
width: '100%', | ||
height: '100%', | ||
borderRadius: '50%', | ||
animation: '$ripple 1.2s infinite ease-in-out', | ||
border: '1px solid currentColor', | ||
content: '""', | ||
}, | ||
}, | ||
'@keyframes ripple': { | ||
'0%': { | ||
transform: 'scale(.8)', | ||
opacity: 1, | ||
}, | ||
'100%': { | ||
transform: 'scale(2.4)', | ||
opacity: 0, | ||
}, | ||
}, | ||
}))(Badge); | ||
|
||
const SmallAvatar = withStyles(theme => ({ | ||
root: { | ||
width: 22, | ||
height: 22, | ||
border: `2px solid ${theme.palette.background.paper}`, | ||
}, | ||
}))(Avatar); | ||
|
||
const useStyles = makeStyles(theme => ({ | ||
root: { | ||
display: 'flex', | ||
'& > *': { | ||
margin: theme.spacing(1), | ||
}, | ||
}, | ||
})); | ||
|
||
export default function BadgeAvatars() { | ||
const classes = useStyles(); | ||
|
||
return ( | ||
<Badge | ||
overlap="circle" | ||
anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }} | ||
badgeContent={1} | ||
color="error" | ||
> | ||
<Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" /> | ||
</Badge> | ||
<div className={classes.root}> | ||
<StyledBadge | ||
overlap="circle" | ||
anchorOrigin={{ | ||
vertical: 'bottom', | ||
horizontal: 'right', | ||
}} | ||
variant="dot" | ||
> | ||
<Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" /> | ||
</StyledBadge> | ||
<Badge | ||
overlap="circle" | ||
anchorOrigin={{ | ||
vertical: 'bottom', | ||
horizontal: 'right', | ||
}} | ||
badgeContent={<SmallAvatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" />} | ||
> | ||
<Avatar alt="Travis Howard" src="/static/images/avatar/2.jpg" /> | ||
</Badge> | ||
</div> | ||
); | ||
} |
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 |
---|---|---|
@@ -1,16 +1,85 @@ | ||
import React from 'react'; | ||
import Badge from '@material-ui/core/Badge'; | ||
import Avatar from '@material-ui/core/Avatar'; | ||
import { Theme, makeStyles, withStyles, createStyles } from '@material-ui/core/styles'; | ||
|
||
const StyledBadge = withStyles((theme: Theme) => | ||
createStyles({ | ||
badge: { | ||
backgroundColor: '#44b700', | ||
color: '#44b700', | ||
boxShadow: `0 0 0 2px ${theme.palette.background.paper}`, | ||
'&::after': { | ||
position: 'absolute', | ||
top: 0, | ||
left: 0, | ||
width: '100%', | ||
height: '100%', | ||
borderRadius: '50%', | ||
animation: '$ripple 1.2s infinite ease-in-out', | ||
border: '1px solid currentColor', | ||
content: '""', | ||
}, | ||
}, | ||
'@keyframes ripple': { | ||
'0%': { | ||
transform: 'scale(.8)', | ||
opacity: 1, | ||
}, | ||
'100%': { | ||
transform: 'scale(2.4)', | ||
opacity: 0, | ||
}, | ||
}, | ||
}), | ||
)(Badge); | ||
|
||
const SmallAvatar = withStyles((theme: Theme) => | ||
createStyles({ | ||
root: { | ||
width: 22, | ||
height: 22, | ||
border: `2px solid ${theme.palette.background.paper}`, | ||
}, | ||
}), | ||
)(Avatar); | ||
|
||
const useStyles = makeStyles((theme: Theme) => | ||
createStyles({ | ||
root: { | ||
display: 'flex', | ||
'& > *': { | ||
margin: theme.spacing(1), | ||
}, | ||
}, | ||
}), | ||
); | ||
|
||
export default function BadgeAvatars() { | ||
const classes = useStyles(); | ||
|
||
return ( | ||
<Badge | ||
overlap="circle" | ||
anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }} | ||
badgeContent={1} | ||
color="error" | ||
> | ||
<Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" /> | ||
</Badge> | ||
<div className={classes.root}> | ||
<StyledBadge | ||
overlap="circle" | ||
anchorOrigin={{ | ||
vertical: 'bottom', | ||
horizontal: 'right', | ||
}} | ||
variant="dot" | ||
> | ||
<Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" /> | ||
</StyledBadge> | ||
<Badge | ||
overlap="circle" | ||
anchorOrigin={{ | ||
vertical: 'bottom', | ||
horizontal: 'right', | ||
}} | ||
badgeContent={<SmallAvatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" />} | ||
> | ||
<Avatar alt="Travis Howard" src="/static/images/avatar/2.jpg" /> | ||
</Badge> | ||
</div> | ||
); | ||
} |
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,32 @@ | ||
import React from 'react'; | ||
import { makeStyles } from '@material-ui/core/styles'; | ||
import Avatar from '@material-ui/core/Avatar'; | ||
|
||
const useStyles = makeStyles(theme => ({ | ||
root: { | ||
display: 'flex', | ||
'& > *': { | ||
margin: theme.spacing(1), | ||
}, | ||
}, | ||
small: { | ||
width: theme.spacing(3), | ||
height: theme.spacing(3), | ||
}, | ||
large: { | ||
width: theme.spacing(7), | ||
height: theme.spacing(7), | ||
}, | ||
})); | ||
|
||
export default function ImageAvatars() { | ||
const classes = useStyles(); | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" className={classes.small} /> | ||
<Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" /> | ||
<Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" className={classes.large} /> | ||
</div> | ||
); | ||
} |
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,34 @@ | ||
import React from 'react'; | ||
import { makeStyles, createStyles, Theme } from '@material-ui/core/styles'; | ||
import Avatar from '@material-ui/core/Avatar'; | ||
|
||
const useStyles = makeStyles((theme: Theme) => | ||
createStyles({ | ||
root: { | ||
display: 'flex', | ||
'& > *': { | ||
margin: theme.spacing(1), | ||
}, | ||
}, | ||
small: { | ||
width: theme.spacing(3), | ||
height: theme.spacing(3), | ||
}, | ||
large: { | ||
width: theme.spacing(7), | ||
height: theme.spacing(7), | ||
}, | ||
}), | ||
); | ||
|
||
export default function ImageAvatars() { | ||
const classes = useStyles(); | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" className={classes.small} /> | ||
<Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" /> | ||
<Avatar alt="Remy Sharp" src="/static/images/avatar/1.jpg" className={classes.large} /> | ||
</div> | ||
); | ||
} |
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 |
---|---|---|
@@ -1,26 +1,30 @@ | ||
import React from 'react'; | ||
import Box from '@material-ui/core/Box'; | ||
import { makeStyles } from '@material-ui/core/styles'; | ||
import Badge from '@material-ui/core/Badge'; | ||
import MailIcon from '@material-ui/icons/Mail'; | ||
|
||
const useStyles = makeStyles(theme => ({ | ||
root: { | ||
'& > *': { | ||
margin: theme.spacing(2), | ||
}, | ||
}, | ||
})); | ||
|
||
export default function BadgeMax() { | ||
const classes = useStyles(); | ||
|
||
return ( | ||
<Box display="flex"> | ||
<Box m={2}> | ||
<Badge badgeContent={99} color="primary"> | ||
<MailIcon /> | ||
</Badge> | ||
</Box> | ||
<Box m={2}> | ||
<Badge badgeContent={100} color="primary"> | ||
<MailIcon /> | ||
</Badge> | ||
</Box> | ||
<Box m={2}> | ||
<Badge badgeContent={1000} max={999} color="primary"> | ||
<MailIcon /> | ||
</Badge> | ||
</Box> | ||
</Box> | ||
<div className={classes.root}> | ||
<Badge badgeContent={99} color="primary"> | ||
<MailIcon /> | ||
</Badge> | ||
<Badge badgeContent={100} color="primary"> | ||
<MailIcon /> | ||
</Badge> | ||
<Badge badgeContent={1000} max={999} color="primary"> | ||
<MailIcon /> | ||
</Badge> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.