import { Tooltip } from '@reach/tooltip'; import * as React from 'react'; import { useTranslation } from 'react-i18next'; import { connect } from '~/components/StateProvider'; import { LazyMotion, domAnimation, m } from 'framer-motion'; import { getTheme, switchTheme } from '~/store/app'; import { State } from '~/store/types'; import s from './ThemeSwitcher.module.scss'; export function ThemeSwitcherImpl({ theme, dispatch }) { const { t } = useTranslation(); const themeIcon = React.useMemo(() => { switch (theme) { case 'dark': return ; case 'auto': return ; case 'light': return ; default: console.assert(false, 'Unknown theme'); return ; } }, [theme]); const onChange = React.useCallback( (e: React.ChangeEvent) => dispatch(switchTheme(e.target.value)), [dispatch], ); return ( {themeIcon} Auto Dark Light ); } function MoonA() { return ( ); } function Sun() { return ( ); } function Auto() { return ( ); } const mapState = (s: State) => ({ theme: getTheme(s) }); export const ThemeSwitcher = connect(mapState)(ThemeSwitcherImpl);