File tree Expand file tree Collapse file tree
examples/next-12/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1-
21import { IconButton } from '@mui/material' ;
32import { useContext } from 'react' ;
43
54import DarkModeIcon from '@mui/icons-material/DarkMode' ;
65import LightModeIcon from '@mui/icons-material/LightMode' ;
7- import { ThemeContext } from '../lib/context/AppThemeContext' ;
6+ import { ThemeContext } from '../lib/context/AppThemeContext' ;
87
98function DynamicIcon ( { mode } ) {
109 if ( mode === 'dark' ) {
@@ -15,11 +14,10 @@ function DynamicIcon({ mode }) {
1514}
1615
1716function ModeToggleButton ( ) {
18- const { setMode, mode} = useContext ( ThemeContext )
19- const toggleMode = ( ) => {
20- setMode ( ( prev ) => prev === "dark" ?"light" :"dark" )
21- }
22-
17+ const { setMode, mode } = useContext ( ThemeContext ) ;
18+ const toggleMode = ( ) => {
19+ setMode ( ( prev ) => ( prev === 'dark' ? 'light' : 'dark' ) ) ;
20+ } ;
2321
2422 return (
2523 < IconButton onClick = { toggleMode } sx = { { width : 40 , height : 40 } } >
You can’t perform that action at this time.
0 commit comments