Skip to content

Commit

Permalink
feat: add theme switch on website home page (#13084)
Browse files Browse the repository at this point in the history
  • Loading branch information
shadab-taiko authored Feb 2, 2023
1 parent 1a647ea commit 34c5501
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
15 changes: 14 additions & 1 deletion packages/website/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
export default function Footer() {
import { ThemeSwitch, useConfig } from "nextra-theme-docs";

export default function Footer({ menu }) {
const config = useConfig();

return (
<footer className="bg-neutral-100 dark:bg-neutral-900">
<div
className={`nx-mx-auto nx-flex nx-py-2 px-8 nx-border dark:nx-border-neutral-800 contrast-more:nx-border-neutral-400
${menu && (config.darkMode)
? 'nx-flex'
: 'nx-hidden'
}`}
>
{config.darkMode && <ThemeSwitch />}
</div>
<div className="grid grid-cols-2 gap-8 px-6 py-8 md:grid-cols-3 md:px-44">
<div>
<h2 className="mb-6 text-sm font-semibold text-neutral-500 uppercase dark:text-neutral-300">
Expand Down
3 changes: 2 additions & 1 deletion packages/website/theme.config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default {
content: null,
},
footer: {
component: <Footer />,
component: Footer,
},
head: () => {
const { asPath } = useRouter();
Expand Down Expand Up @@ -46,4 +46,5 @@ export default {
titleTemplate: "%s – Taiko",
};
},
darkMode: true,
};

0 comments on commit 34c5501

Please sign in to comment.