Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#35 update alert badge for small screens #36

Merged
merged 1 commit into from
Oct 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions app/src/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import IconButton from '@material-ui/core/IconButton';
import Container from '@material-ui/core/Container';
import Link from '@material-ui/core/Link';
import MenuIcon from '@material-ui/icons/Menu';
/*
import Badge from '@material-ui/core/Badge';
/*
import NotificationsIcon from '@material-ui/icons/Notifications';
*/

Expand Down Expand Up @@ -151,6 +151,7 @@ const Dashboard = (props) => {
const handleDrawerClose = () => {
setOpen(false);
};
const shouldShowUpdateBadge = useMediaQuery(createMuiTheme().breakpoints.down('md')) && props.newServiceWorkerDetected;

return (
<AppThemeProvider type={ theme } >
Expand All @@ -165,7 +166,9 @@ const Dashboard = (props) => {
onClick={handleDrawerOpen}
className={clsx(classes.menuButton, open && classes.menuButtonHidden)}
>
<MenuIcon />
<Badge badgeContent={1} color={"secondary"} invisible={!shouldShowUpdateBadge}>
<MenuIcon />
</Badge>
</IconButton>
<Typography component="h1" variant="h6" color="inherit" noWrap className={classes.title}>
{ t("Covid Data") }{' '}
Expand Down