From 7bdfc7cef884d01c7989e8b649f49cbde17502dc Mon Sep 17 00:00:00 2001 From: adil <68734155+adevinwild@users.noreply.github.com> Date: Sat, 28 Oct 2023 11:55:12 +0200 Subject: [PATCH 1/9] feat: :sparkles: Added a theme selector in the header - Updated `tailwind.config.cjs` to add the `darkMode:"class"` property - Added a script to handle the default theme value in the `DocsPage` - Added two icons (Moon and Sun) from `heroicons` - Implemented the `ThemeToggle` component inside the Header --- src/components/Header.astro | 62 ++++++++++++++------------- src/components/react/icons/moon.tsx | 18 ++++++++ src/components/react/icons/sun.tsx | 18 ++++++++ src/components/react/theme-toggle.tsx | 38 ++++++++++++++++ src/layouts/DocsPage.astro | 22 ++++++++++ tailwind.config.cjs | 1 + 6 files changed, 129 insertions(+), 30 deletions(-) create mode 100644 src/components/react/icons/moon.tsx create mode 100644 src/components/react/icons/sun.tsx create mode 100644 src/components/react/theme-toggle.tsx diff --git a/src/components/Header.astro b/src/components/Header.astro index 2c49b7a5..ecf8178c 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -1,21 +1,26 @@ --- -import NavLink from './NavLink.astro'; -import { Container } from './react/container'; -import mswLogo from '../images/msw.svg' -import Search from './Search.astro'; -import { MobileMenu } from './react/mobileMenu'; -import { SponsorLink } from './react/sponsorLink'; +import NavLink from "./NavLink.astro"; +import { Container } from "./react/container"; +import mswLogo from "../images/msw.svg"; +import Search from "./Search.astro"; +import { MobileMenu } from "./react/mobileMenu"; +import { SponsorLink } from "./react/sponsorLink"; +import { ThemeToggle } from "./react/theme-toggle"; type Props = { - isFluid?: boolean -} + isFluid?: boolean; +}; -const { isFluid } = Astro.props +const { isFluid } = Astro.props; --- -
+
-
+
-
+