feat: single SOT for themes + basic custom support

This commit is contained in:
Gabe Farrell 2025-06-17 02:44:41 -04:00
parent 486f5d0269
commit 5459cef971
10 changed files with 645 additions and 695 deletions

View file

@ -1,25 +1,15 @@
// ThemeSwitcher.tsx
import { useEffect } from 'react';
import { useTheme } from '../../hooks/useTheme';
import { themes } from '~/providers/ThemeProvider';
import themes from '~/styles/themes.css';
import ThemeOption from './ThemeOption';
export function ThemeSwitcher() {
const { theme, setTheme } = useTheme();
useEffect(() => {
const saved = localStorage.getItem('theme');
if (saved && saved !== theme) {
setTheme(saved);
} else if (!saved) {
localStorage.setItem('theme', theme)
}
}, []);
useEffect(() => {
if (theme) {
localStorage.setItem('theme', theme)
setTheme(theme)
}
}, [theme]);