Skip to content

Commit

Permalink
🔧 add theme support
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineKM committed Dec 8, 2022
1 parent fbac6c4 commit fcfd679
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/theme.config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import { DocsThemeConfig, useConfig } from "nextra-theme-docs";
import { useRouter } from "next/router";
import urlcat from "urlcat";
import { useTheme as useNextraTheme } from "next-themes";
import { useTheme } from "@tonightpass/kitchen";

const logo = (
<span>
Expand Down Expand Up @@ -40,6 +42,10 @@ const config: DocsThemeConfig = {
},
logo,
head: () => {
const { theme = "system" } = useNextraTheme();
const { setStoredTheme } = useTheme();
setStoredTheme(theme === "dark" ? 1 : theme === "light" ? 2 : 0);

const { title, ...meta } = useConfig().frontMatter;

const finalTitle = title ? `${title} - Kitchen` : "Kitchen";
Expand Down Expand Up @@ -94,6 +100,7 @@ const config: DocsThemeConfig = {
editLink: {
text: "Edit this page on GitHub",
},
primaryHue: 281,
};

export default config;

1 comment on commit fcfd679

@vercel
Copy link

@vercel vercel bot commented on fcfd679 Dec 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.