Skip to content

Commit 5067c7e

Browse files
committed
fix(ui): apply theme to the html element
1 parent f135c98 commit 5067c7e

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

‎ui/src/routes/__root.tsx‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import React from "react";
1+
import React, { useEffect } from "react";
22
import { Outlet, createRootRoute } from "@tanstack/react-router";
33

4-
import { cn } from "@/lib/utils";
54
import { Logo } from "@/components/logo";
65
import { useTheme } from "@/provider/theme.provider";
76

@@ -22,14 +21,13 @@ export const Route = createRootRoute({
2221
function Root() {
2322
const theme = useTheme();
2423

24+
useEffect(() => {
25+
document.documentElement.classList.toggle("dark", theme === "dark");
26+
}, [theme]);
27+
2528
return (
2629
<>
27-
<div
28-
className={cn(
29-
"flex min-h-screen w-full flex-col bg-background",
30-
theme === "dark" && "dark",
31-
)}
32-
>
30+
<div className="flex min-h-screen w-full flex-col bg-background">
3331
<Outlet />
3432
</div>
3533
<TanStackRouterDevtools />

0 commit comments

Comments
 (0)