Skip to content

Commit 564e446

Browse files
committed
perf(web): use document element instead of body for theme
1 parent 1c63d7e commit 564e446

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

apps/web/src/entry-server.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { createHandler, StartServer } from "@solidjs/start/server";
44
export default createHandler((event) => (
55
<StartServer
66
document={({ assets, children, scripts }) => (
7-
<html lang={event.locals.settings.locale}>
7+
<html lang={event.locals.settings.locale} data-theme={event.locals.settings.theme}>
88
<head>
99
<meta charset="UTF-8" />
1010
<title>Quotepedia</title>
@@ -29,7 +29,7 @@ export default createHandler((event) => (
2929
<link rel="manifest" href="/manifest.json" />
3030
{assets}
3131
</head>
32-
<body class="overflow-x-hidden transition-colors" data-theme={event.locals.settings.theme}>
32+
<body class="overflow-x-hidden transition-colors">
3333
<div id="app" class="flex min-h-dvh">
3434
{children}
3535
</div>

apps/web/src/lib/theme/Provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const ThemeProvider: ParentComponent = (props) => {
1010
const setTheme = (theme: Theme) => settings.set("theme", theme);
1111

1212
createEffect(() => {
13-
document.body.dataset.theme = theme();
13+
document.documentElement.dataset.theme = theme();
1414
});
1515

1616
const context: ThemeContextValue = {

0 commit comments

Comments
 (0)