Skip to content

Commit

Permalink
chore: run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
frectonz committed Jun 22, 2024
1 parent bb6ed24 commit 28a7a6a
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions ui/src/provider/theme.provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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());

0 comments on commit 28a7a6a

Please sign in to comment.