Skip to content

Commit

Permalink
fix: fix theme not respected bug
Browse files Browse the repository at this point in the history
This commit makes sure that the theme that is stored in the local
storage is respected.
  • Loading branch information
rickstaa committed Oct 19, 2022
1 parent 3217c57 commit f19abd6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ export interface SnackbarMessage {
const App = () => {
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
const [mode, setMode] = useState(() => {
return window.localStorage.getItem("mode") || prefersDarkMode
? "dark"
: "light";
return (
window.localStorage.getItem("mode") ||
(prefersDarkMode ? "dark" : "light")
);
});
const [snackPack, setSnackPack] = useState<readonly SnackbarMessage[]>([]);
const [open, setOpen] = useState(false);
Expand Down

1 comment on commit f19abd6

@vercel
Copy link

@vercel vercel bot commented on f19abd6 Oct 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.