Skip to content

Commit

Permalink
Fix theme on dark landing page
Browse files Browse the repository at this point in the history
  • Loading branch information
moloch-- committed Dec 16, 2023
1 parent 8c5d3dd commit ad7e1dc
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions docs/sliver-docs/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import AsciinemaPlayer from "@/components/asciinema";
import { Themes } from "@/util/themes";
import { Card, CardBody, CardHeader, Divider } from "@nextui-org/react";
import { useTheme } from "next-themes";

export default function Home() {
const { theme } = useTheme();
function getThemeState(): Themes {
if (typeof window !== "undefined") {
const loadedTheme = localStorage.getItem("theme");
const currentTheme = loadedTheme ? (loadedTheme as Themes) : Themes.DARK;
return currentTheme;
}
return Themes.DARK;
}

return (
<div className="grid grid-cols-12 mt-2">
Expand All @@ -29,7 +35,7 @@ export default function Home() {
<CardBody>
<p
className={
theme === Themes.DARK
getThemeState() === Themes.DARK
? "prose prose-sm dark:prose-invert"
: "prose prose-sm prose-slate"
}
Expand Down

0 comments on commit ad7e1dc

Please sign in to comment.