1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-09-18 16:05:33 -04:00

simplify theme provider

This commit is contained in:
2025-03-01 16:08:12 -05:00
parent 9c4d14fa45
commit 36faa6c234
11 changed files with 99 additions and 120 deletions

View File

@@ -14,13 +14,13 @@ export type ThemeToggleProps = {
const ThemeToggle = ({ className }: ThemeToggleProps) => {
const hasMounted = useHasMounted();
const { activeTheme, setTheme } = useTheme();
const { theme, setTheme } = useTheme();
const isFirstMount = useFirstMountState();
const prefersReducedMotion = useReducedMotion() ?? false;
const maskId = useId(); // SSR-safe ID to cross-reference areas of the SVG
// default to light since `activeTheme` might be undefined
const safeTheme = activeTheme === "dark" ? activeTheme : "light";
// default to light since `theme` might be undefined
const safeTheme = theme === "dark" ? theme : "light";
// accessibility: disable animation if user prefers reduced motion
useEffect(() => {