Skip to content

Commit

Permalink
fix: storybook dark mode to light mode toggle (#2299)
Browse files Browse the repository at this point in the history
If you load/reload the page in dark mode, switching to light mode is
buggy.
  • Loading branch information
ChristianBusshoff authored Dec 10, 2024
1 parent 41c2adf commit c57e18e
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions packages/storybook-utils/src/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,9 @@ export const createPreview = <T extends Preview = Preview>(
if (isDark) {
document.body.classList.remove("light");
document.body.classList.add("dark");
document.documentElement.style.colorScheme = "dark";
} else {
document.body.classList.remove("dark");
document.body.classList.add("light");
document.documentElement.style.colorScheme = "light";
}

return isDark ? themes.dark : themes.light;
Expand Down

0 comments on commit c57e18e

Please sign in to comment.