diff --git a/package.json b/package.json index ac464ba243..40ade1e23d 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "postinstall": "preconstruct dev && manypkg check", "changeset": "changeset", "version-packages": "changeset version && yarn --mode=\"update-lockfile\"", + "lucide-react": "^0.469.0", "release": "yarn build && changeset publish" }, "author": "Kye Hohenberger", diff --git a/site/components/global-styles.tsx b/site/components/global-styles.tsx index 8da8e4d3f7..ca0bf918e0 100644 --- a/site/components/global-styles.tsx +++ b/site/components/global-styles.tsx @@ -3,6 +3,22 @@ import { ReactElement } from 'react' import { colors, draculaPrism } from '../util' const globalCss = css({ + ':root': { + '--background-color': '#ffffff', + '--text-color': '#000000', + '--link-color': colors.pink, + '--link-hover-color': colors.hightlight, + }, + '.dark': { + '--background-color': '#121212', + '--text-color': '#ffffff', + '--link-color': colors.pink, // Adjust if different in dark mode + '--link-hover-color': colors.hightlight, // Adjust if different in dark mode + }, + body: { + backgroundColor: 'var(--background-color)', + color: 'var(--text-color)', + }, a: { color: colors.pink, textDecoration: 'none' diff --git a/site/components/site-header.tsx b/site/components/site-header.tsx index b833c9f543..8ec8bd36b1 100644 --- a/site/components/site-header.tsx +++ b/site/components/site-header.tsx @@ -4,6 +4,8 @@ import { colors, mediaQueries, styleConstants } from '../util' import { css } from '@emotion/react' import { useRouter } from 'next/router' import { Container } from './container' +import {useState, useEffect} from'react' +import { Moon, Sun } from 'lucide-react' export const animatedUnderline = css({ '&::after': { @@ -89,7 +91,21 @@ export function SiteHeader() { const path = router.asPath const onCommunityPage = path === '/docs/community' + const [darkMode, setDarkMode] = useState(false); + useEffect(() => { + const isDark = localStorage.getItem('darkMode') === 'true'; + setDarkMode(isDark); + if (isDark) { + document.documentElement.classList.add('dark'); + } + }, []); + const toggleDarkMode = () => { + const newDarkMode = !darkMode; + setDarkMode(newDarkMode); + localStorage.setItem('darkMode', String(newDarkMode)); + document.documentElement.classList.toggle('dark'); + }; return ( <> @@ -170,6 +186,20 @@ export function SiteHeader() { listStyle: 'none' }} > + +
  • + +