Skip to content

Commit 3c81310

Browse files
author
Emile Frey
committed
adds tooltip to theme toggler and corrects the icon displayed while in light/dark themes
1 parent 501f876 commit 3c81310

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

frontend/src/components/Layout/TopBar.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useContext } from 'react';
22
import { makeStyles } from '@material-ui/core/styles';
3-
import { AppBar, IconButton, Toolbar, Typography } from '@material-ui/core';
3+
import { AppBar, IconButton, Toolbar, Tooltip, Typography } from '@material-ui/core';
44
import { APP_NAME } from '../../settings'
55
import { AccountCircle } from '@material-ui/icons';
66
import MenuItem from '@material-ui/core/MenuItem';
@@ -24,16 +24,18 @@ const useStyles = makeStyles((theme) => ({
2424
export default function TopBar(props: AppProps) {
2525
const classes = useStyles();
2626
const { darkMode, setDarkMode } = useContext(ThemeContext);
27-
27+
2828
return (
2929
<AppBar position="relative">
3030
<Toolbar className={props.isAuthenticated ? classes.authToolbar : undefined}>
3131
<Typography variant="h5" align="center" className={classes.title}>
3232
{APP_NAME}
3333
</Typography>
34-
<IconButton color="inherit" onClick={() => setDarkMode(!darkMode)} >
35-
{darkMode ? <Brightness4Icon/> : <Brightness7Icon />}
36-
</IconButton>
34+
<Tooltip title={`Toggle light/dark theme`}>
35+
<IconButton color="inherit" onClick={() => setDarkMode(!darkMode)} >
36+
{darkMode ? <Brightness7Icon /> : <Brightness4Icon />}
37+
</IconButton>
38+
</Tooltip>
3739
{props.isAuthenticated && (
3840
<DropdownMenu dropdownButtonIcon={<AccountCircle />}>
3941
<div>

0 commit comments

Comments
 (0)