sendou.ink/app/components/layout/ColorModeToggle.tsx
Kalle e97fcd4e99 Remove Cypress tests
Planned to be replaced with Playwright maybe?
Just removing in the meanwhile so they don't confuse people.
Or that people won't accidentally develop new.
2022-10-30 02:15:15 +03:00

21 lines
588 B
TypeScript

import { Theme, useTheme } from "~/modules/theme";
import { MoonIcon } from "../icons/Moon";
import { SunIcon } from "../icons/Sun";
export function ColorModeToggle() {
const [, setTheme] = useTheme();
const toggleTheme = () => {
setTheme((prevTheme) =>
prevTheme === Theme.LIGHT ? Theme.DARK : Theme.LIGHT
);
};
return (
<button className="layout__header__button" onClick={toggleTheme}>
<SunIcon className="light-mode-only layout__header__button__icon" />
<MoonIcon className="dark-mode-only layout__header__button__icon" />
</button>
);
}