-
-
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.
[docs] Add Badge Typescript demo for Maximum Value (#15013)
* add typescript demo for BadgeMax * format
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 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,37 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { withStyles, Theme, createStyles, WithStyles } from '@material-ui/core/styles'; | ||
import Badge from '@material-ui/core/Badge'; | ||
import MailIcon from '@material-ui/icons/Mail'; | ||
|
||
const styles = (theme: Theme) => | ||
createStyles({ | ||
margin: { | ||
margin: theme.spacing(2), | ||
marginRight: theme.spacing(3), | ||
}, | ||
}); | ||
|
||
function BadgeMax(props: WithStyles<typeof styles>) { | ||
const { classes } = props; | ||
|
||
return ( | ||
<React.Fragment> | ||
<Badge className={classes.margin} badgeContent={99} color="primary"> | ||
<MailIcon /> | ||
</Badge> | ||
<Badge className={classes.margin} badgeContent={100} color="primary"> | ||
<MailIcon /> | ||
</Badge> | ||
<Badge className={classes.margin} badgeContent={1000} max={999} color="primary"> | ||
<MailIcon /> | ||
</Badge> | ||
</React.Fragment> | ||
); | ||
} | ||
|
||
BadgeMax.propTypes = { | ||
classes: PropTypes.object.isRequired, | ||
} as any; | ||
|
||
export default withStyles(styles)(BadgeMax); |