Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add theme switch on website home page #13084

Merged
merged 2 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
};