diff --git a/ui/src/provider/theme.provider.tsx b/ui/src/provider/theme.provider.tsx index a5f7960..d08dcbe 100644 --- a/ui/src/provider/theme.provider.tsx +++ b/ui/src/provider/theme.provider.tsx @@ -4,20 +4,19 @@ export type Theme = "dark" | "light"; function initialState(): Theme { if (localStorage.getItem("theme") !== null) { - return localStorage.getItem("theme") === "dark" ? "dark" : "light" + return localStorage.getItem("theme") === "dark" ? "dark" : "light"; } - return window.matchMedia('(prefers-color-scheme: dark)').matches ? "dark" : "light" + return window.matchMedia("(prefers-color-scheme: dark)").matches + ? "dark" + : "light"; } export const { StoreProvider: ThemeProvider, useDispatch: setTheme, useStore: useTheme, -} = createStore( - (_, next: Theme) => { - localStorage.setItem("theme", next); - return next; - }, - initialState(), -); +} = createStore((_, next: Theme) => { + localStorage.setItem("theme", next); + return next; +}, initialState());