@material-ui/core/#Badge JavaScript Examples

The following examples show how to use @material-ui/core/#Badge. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Inventory.js    From inventory-management-web with MIT License 5 votes vote down vote up
export default function Inventory() {
  // index of current tab
  const [tab, setTab] = useState(0);

  const classes = useStyles();

  const { expiryListBadge } = useContext(ExpiryListContext);

  // set the tab to new index
  const handleTabChange = (event, newValue) => {
    setTab(newValue);
  };

  return (
    <div className={classes.root}>
      <Typography variant='h3' className={classes.heading} gutterBottom>
        Inventory
      </Typography>
      <StyledTabs value={tab} onChange={handleTabChange}>
        <StyledTab label='All' />
        <StyledTab
          style={{ paddingRight: '2rem' }}
          label={
            // eslint-disable-next-line react/jsx-wrap-multilines
            <Badge
              badgeContent={expiryListBadge}
              color='primary'
              overlap='circle'
              className={classes.badge}
            >
              Near expiry
            </Badge>
          }
        />
      </StyledTabs>
      <TabPanel value={tab} index={0}>
        <InventoryTable />
      </TabPanel>
      <TabPanel value={tab} index={1}>
        <Typography variant='h6' gutterBottom>
          Items which expire in the next 3 days are displayed here
        </Typography>
        <ExpiryTable />
      </TabPanel>
    </div>
  );
}