diff --git a/site/components/site-header.tsx b/site/components/site-header.tsx
index b833c9f54..ca957381f 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': {
@@ -70,9 +72,8 @@ function UkraineBanner() {
css={{
fontWeight: 'bold',
color: '#fff',
- fontSize: 20,
-
- [mediaQueries.mdUp]: {
+ fontSize: 20,
+ [mediaQueries.mdUp]: {
fontSize: 28
}
}}
@@ -83,13 +84,26 @@ function UkraineBanner() {
)
}
-
export function SiteHeader() {
const router = useRouter()
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 (
<>