2eee5195cc
* new react and reactdom packages in wallet * new react and reactdom packages in root * new react and reactdom packages in nym connect * new react and reactdom packages in root * update react and reactdom for explorer * react and react-dom upgrade for ts-packages remove unused import fix linting error * use custom FC typing move typings folder * fix type error
22 lines
863 B
TypeScript
22 lines
863 B
TypeScript
import * as React from 'react';
|
|
import { Button, Typography } from '@mui/material';
|
|
import DarkModeIcon from '@mui/icons-material/DarkMode';
|
|
import LightModeIcon from '@mui/icons-material/LightMode';
|
|
import { useAppContext } from './context';
|
|
|
|
export const ThemeToggle: FCWithChildren = () => {
|
|
const { mode, toggleMode } = useAppContext();
|
|
return (
|
|
<Button variant="outlined" color="secondary" onClick={toggleMode} sx={{ display: 'flex', alignItems: 'centre' }}>
|
|
{mode === 'dark' ? (
|
|
<DarkModeIcon sx={{ color: (theme) => theme.palette.text.secondary }} />
|
|
) : (
|
|
<LightModeIcon sx={{ color: (theme) => theme.palette.text.secondary }} />
|
|
)}
|
|
<Typography ml={1} color={(theme) => theme.palette.primary.light}>
|
|
Switch to {mode === 'dark' ? 'light mode' : 'dark mode'}
|
|
</Typography>
|
|
</Button>
|
|
);
|
|
};
|