-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Justin Campbell
committed
Jul 9, 2020
1 parent
8dc9f6e
commit 88da720
Showing
1 changed file
with
56 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,56 @@ | ||
| import React from "react"; | ||
| import {makeStyles, Tooltip, Typography, AppBar, Toolbar, IconButton, Zoom} from "@material-ui/core" | ||
| import MenuIcon from "@material-ui/icons/Menu"; | ||
| import DarkModeIcon from '@material-ui/icons/Brightness4'; | ||
| import LightModeIcon from '@material-ui/icons/Brightness7'; | ||
|
|
||
|
|
||
| export default function CustomAppBar(props){ | ||
| const useStyles = makeStyles((theme) => ({ | ||
| root: { | ||
| flexGrow: 1, | ||
| }, | ||
| menuButton: { | ||
| marginLeft: theme.spacing(2), | ||
| }, | ||
| title: { | ||
| flexGrow: 1, | ||
| }, | ||
| tooltip: { | ||
| fontSize: theme.typography.pxToRem(14), | ||
| } | ||
| })); | ||
|
|
||
| const classes = useStyles(props.theme); | ||
|
|
||
| const toggleDarkMode = () => props.setDarkMode(!props.darkMode); | ||
|
|
||
| return( | ||
| <div className={classes.root}> | ||
| <AppBar position="fixed"> | ||
| <Toolbar> | ||
| <Typography variant="h6" className={classes.title}> | ||
| {props.title} | ||
| </Typography> | ||
|
|
||
| <Tooltip title={"Turn " + (props.darkMode ? "off" : "on") + " dark mode"} | ||
| arrow | ||
| classes={classes.tooltip} | ||
| onClick={toggleDarkMode} | ||
| TransitionComponent={Zoom} | ||
| > | ||
| <IconButton color="inherit"> | ||
| {props.darkMode ? <DarkModeIcon /> : <LightModeIcon />} | ||
| </IconButton> | ||
| </Tooltip> | ||
|
|
||
| <IconButton edge="end" className={classes.menuButton} color="inherit" aria-label="menu"> | ||
| <MenuIcon /> | ||
| </IconButton> | ||
| </Toolbar> | ||
| </AppBar> | ||
| {/* Empty toolbar is to offset content below AppBar */} | ||
| <Toolbar /> | ||
| </div> | ||
| ); | ||
| } |