Skip to content

Commit

Permalink
[docs] Add Badge Typescript demo for Maximum Value (#15013)
Browse files Browse the repository at this point in the history
* add typescript demo for BadgeMax
 
* format
  • Loading branch information
Rahmat Hidayat authored and eps1lon committed Mar 23, 2019
1 parent 7ee2a08 commit 8350129
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions docs/src/pages/demos/badges/BadgeMax.tsx
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);

0 comments on commit 8350129

Please sign in to comment.