import * as React from 'react'; import { styled } from '@mui/material/styles'; import Switch from '@mui/material/Switch'; import { Button } from '@mui/material'; import { useMainContext } from '../context/main'; import { LightSwitchSVG } from '../icons/LightSwitchSVG'; export const DarkLightSwitch = styled(Switch)(({ theme }) => ({ width: 55, height: 34, padding: 7, '& .MuiSwitch-switchBase': { margin: 1, padding: 2, transform: 'translateX(4px)', '&.Mui-checked': { color: '#fff', transform: 'translateX(22px)', '& .MuiSwitch-thumb:before': { backgroundImage: 'url(\'data:image/svg+xml;utf8,\')', }, '& + .MuiSwitch-track': { opacity: 1, backgroundColor: theme.palette.mode === 'dark' ? '#8796A5' : '#aab4be', }, }, }, '& .MuiSwitch-thumb': { backgroundColor: theme.palette.nym.networkExplorer.nav.text, width: 25, height: 25, marginTop: '2px', '&:before': { content: "''", position: 'absolute', width: '100%', height: '100%', left: 0, top: 0, backgroundRepeat: 'no-repeat', backgroundPosition: 'center', backgroundImage: 'url(\'data:image/svg+xml;utf8,\')', }, }, '& .MuiSwitch-track': { opacity: 1, backgroundColor: theme.palette.mode === 'dark' ? '#8796A5' : '#aab4be', borderRadius: 20 / 2, }, })); export const DarkLightSwitchMobile: FCWithChildren = () => { const { toggleMode } = useMainContext(); return ( ); }; export const DarkLightSwitchDesktop: FCWithChildren<{ defaultChecked: boolean }> = ({ defaultChecked }) => { const { toggleMode } = useMainContext(); return ( ); };