blob: 7a835e61b0ad433c3c74b224e6872244607b1a67 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
/*
* SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/>
*
* SPDX-License-Identifier: EPL-2.0
*/
import DarkModeIcon from '@mui/icons-material/DarkMode';
import LightModeIcon from '@mui/icons-material/LightMode';
import IconButton from '@mui/material/IconButton';
import { observer } from 'mobx-react-lite';
import { useRootStore } from './RootStoreProvider';
export default observer(function ToggleDarkModeButton(): JSX.Element {
const { themeStore } = useRootStore();
const { darkMode } = themeStore;
return (
<IconButton
color="inherit"
onClick={() => themeStore.toggleDarkMode()}
aria-label={darkMode ? 'Switch to light mode' : 'Switch to dark mode'}
>
{darkMode ? <LightModeIcon /> : <DarkModeIcon />}
</IconButton>
);
});
|