Skip to content

Commit

Permalink
fix(+layout): added browser check for darkMode
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Howell committed Oct 6, 2022
1 parent 633c07f commit a2bf00c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { page } from '$app/stores';
import { Button, Drawer, Swap, Icon, Layout, Menu, Portal, Row, Toggle } from '../lib';
import { browser } from '$app/environment';
const sidebarItems = [
{
Expand Down Expand Up @@ -172,10 +173,10 @@
openMenu = false;
}
$: if (darkTheme) {
$: if (browser && darkTheme) {
const htmlElement = document.documentElement;
htmlElement.classList.add('dark');
} else {
} else if (browser) {
const htmlElement = document.documentElement;
htmlElement.classList.remove('dark');
}
Expand Down

0 comments on commit a2bf00c

Please sign in to comment.