11import React , { useContext , useState } from 'react' ;
2- import { makeStyles } from '@material-ui/core/styles' ;
3- import AppBar from '@material-ui/core/AppBar' ;
4- import Toolbar from '@material-ui/core/Toolbar' ;
5- import Typography from '@material-ui/core/Typography' ;
6- import IconButton from '@material-ui/core/IconButton' ;
7- import MenuIcon from '@material-ui/icons/Menu' ;
2+ import AppBar from '@mui/material/AppBar' ;
3+ import Toolbar from '@mui/material/Toolbar' ;
4+ import Typography from '@mui/material/Typography' ;
5+ import IconButton from '@mui/material/IconButton' ;
6+ import MenuIcon from '@mui/icons-material/Menu' ;
87import { Link } from 'gatsby' ;
9- import Brightness5Icon from '@material-ui/icons/Brightness5' ;
10- import Brightness7Icon from '@material-ui/icons/Brightness7' ;
8+ import Brightness5Icon from '@mui/icons-material/Brightness5' ;
9+ import Brightness7Icon from '@mui/icons-material/Brightness7' ;
10+ import { useTheme } from '@mui/material/styles' ;
1111import NavigationDrawer from '../NavigationDrawer' ;
1212import { MainContext } from '../../contexts/MainContextProvider' ;
1313import { setThemeIndex } from '../../reducers/MainReducer/Actions' ;
1414
15- const useStyles = makeStyles ( ( theme ) => ( {
16- root : {
17- flexGrow : 1 ,
18- } ,
19- menuButton : {
20- marginRight : theme . spacing ( 2 ) ,
21- } ,
22- title : {
23- flexGrow : 1 ,
24- } ,
25- } ) ) ;
26-
2715const DefaultAppBar = ( {
2816 title,
2917} ) => {
3018 const [ state , dispatch ] = useContext ( MainContext ) ;
3119
3220 const { themeIndex } = state ;
3321
34- const classes = useStyles ( ) ;
22+ const theme = useTheme ( ) ;
3523 const [ drawerOpen , setDrawerOpen ] = useState ( false ) ;
3624
3725 /**
@@ -42,12 +30,14 @@ const DefaultAppBar = ({
4230 } ;
4331
4432 return (
45- < div className = { classes . root } >
33+ < div style = { { flexGrow : 1 } } >
4634 < AppBar position = "static" >
4735 < Toolbar >
4836 < IconButton
4937 edge = "start"
50- className = { classes . menuButton }
38+ sx = { {
39+ marginRight : theme . spacing ( 2 ) ,
40+ } }
5141 color = "inherit"
5242 aria-label = "menu"
5343 onClick = { ( ) => setDrawerOpen ( true ) }
@@ -66,7 +56,7 @@ const DefaultAppBar = ({
6656 </ Typography >
6757 </ Link >
6858
69- < div className = { classes . title } />
59+ < div style = { { flexGrow : 1 } } />
7060
7161 < IconButton color = "inherit" onClick = { changeTheme } >
7262 { themeIndex === 1 ? < Brightness5Icon /> : < Brightness7Icon /> }
0 commit comments