fix: default theme

This commit is contained in:
hamster1963
2024-11-23 19:55:15 +08:00
parent 82a7e0f34d
commit b6b9eae76d
3 changed files with 16 additions and 3 deletions

View File

@@ -22,11 +22,10 @@ const ThemeProviderContext = createContext<ThemeProviderState>(initialState);
export function ThemeProvider({
children,
defaultTheme = "system",
storageKey = "vite-ui-theme",
}: ThemeProviderProps) {
const [theme, setTheme] = useState<Theme>(
() => (localStorage.getItem(storageKey) as Theme) || defaultTheme,
() => (localStorage.getItem(storageKey) as Theme) || "system",
);
useEffect(() => {