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

Patch 3 #3302

Closed
wants to merge 2 commits into from
Closed

Patch 3 #3302

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
16 changes: 16 additions & 0 deletions site/components/global-styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@
import { colors, draculaPrism } from '../util'

const globalCss = css({
':root': {

Check failure on line 6 in site/components/global-styles.tsx

View workflow job for this annotation

GitHub Actions / Linting

Delete `··`

Check failure on line 6 in site/components/global-styles.tsx

View workflow job for this annotation

GitHub Actions / Linting

Delete `··`
'--background-color': '#ffffff',
'--text-color': '#000000',
'--link-color': colors.pink,
'--link-hover-color': colors.hightlight,

Check failure on line 10 in site/components/global-styles.tsx

View workflow job for this annotation

GitHub Actions / Linting

Delete `,`

Check failure on line 10 in site/components/global-styles.tsx

View workflow job for this annotation

GitHub Actions / Linting

Delete `,`
},
'.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

Check failure on line 16 in site/components/global-styles.tsx

View workflow job for this annotation

GitHub Actions / Linting

Delete `,`

Check failure on line 16 in site/components/global-styles.tsx

View workflow job for this annotation

GitHub Actions / Linting

Delete `,`
},
body: {
backgroundColor: 'var(--background-color)',
color: 'var(--text-color)',

Check failure on line 20 in site/components/global-styles.tsx

View workflow job for this annotation

GitHub Actions / Linting

Delete `,`

Check failure on line 20 in site/components/global-styles.tsx

View workflow job for this annotation

GitHub Actions / Linting

Delete `,`
},
a: {
color: colors.pink,
textDecoration: 'none'
Expand Down
38 changes: 32 additions & 6 deletions site/components/site-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import { css } from '@emotion/react'
import { useRouter } from 'next/router'
import { Container } from './container'
import {useState, useEffect} from'react'

Check failure on line 7 in site/components/site-header.tsx

View workflow job for this annotation

GitHub Actions / Linting

Replace `useState,·useEffect}·from` with `·useState,·useEffect·}·from·`

Check failure on line 7 in site/components/site-header.tsx

View workflow job for this annotation

GitHub Actions / Linting

Replace `useState,·useEffect}·from` with `·useState,·useEffect·}·from·`
import { Moon, Sun } from 'lucide-react'

Check failure on line 8 in site/components/site-header.tsx

View workflow job for this annotation

GitHub Actions / TypeScript

Cannot find module 'lucide-react' or its corresponding type declarations.

Check failure on line 8 in site/components/site-header.tsx

View workflow job for this annotation

GitHub Actions / TypeScript

Cannot find module 'lucide-react' or its corresponding type declarations.

export const animatedUnderline = css({
'&::after': {
Expand Down Expand Up @@ -70,9 +72,8 @@
css={{
fontWeight: 'bold',
color: '#fff',
fontSize: 20,

[mediaQueries.mdUp]: {
fontSize: 20,

Check failure on line 75 in site/components/site-header.tsx

View workflow job for this annotation

GitHub Actions / Linting

Insert `·`

Check failure on line 75 in site/components/site-header.tsx

View workflow job for this annotation

GitHub Actions / Linting

Insert `·`
[mediaQueries.mdUp]: {

Check failure on line 76 in site/components/site-header.tsx

View workflow job for this annotation

GitHub Actions / Linting

Insert `·`

Check failure on line 76 in site/components/site-header.tsx

View workflow job for this annotation

GitHub Actions / Linting

Insert `·`
fontSize: 28
}
}}
Expand All @@ -83,13 +84,26 @@
</a>
)
}

export function SiteHeader() {
const router = useRouter()

const path = router.asPath
const onCommunityPage = path === '/docs/community'
const [darkMode, setDarkMode] = useState(false);

Check failure on line 92 in site/components/site-header.tsx

View workflow job for this annotation

GitHub Actions / Linting

Delete `;`

Check failure on line 92 in site/components/site-header.tsx

View workflow job for this annotation

GitHub Actions / Linting

Delete `;`
useEffect(() => {

Check failure on line 93 in site/components/site-header.tsx

View workflow job for this annotation

GitHub Actions / Linting

Delete `··`

Check failure on line 93 in site/components/site-header.tsx

View workflow job for this annotation

GitHub Actions / Linting

Delete `··`
const isDark = localStorage.getItem('darkMode') === 'true';

Check failure on line 94 in site/components/site-header.tsx

View workflow job for this annotation

GitHub Actions / Linting

Delete `;`

Check failure on line 94 in site/components/site-header.tsx

View workflow job for this annotation

GitHub Actions / Linting

Delete `;`
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 (
<>
<UkraineBanner />
Expand All @@ -100,7 +114,6 @@
boxShadow: '0 .125rem .25rem rgba(0, 0, 0, .075)',
paddingTop: '0.25rem',
marginBottom: '1.5rem',

[mediaQueries.mdUp]: {
marginBottom: '2.5rem'
}
Expand Down Expand Up @@ -153,7 +166,6 @@
css={{
marginLeft: 'auto',
overflowX: 'auto',

// For proper scrollbar placement on mobile. Note, mobile scrollbars
// are pretty different between Safari and Chrome
padding: '0.25rem 0'
Expand All @@ -170,6 +182,20 @@
listStyle: 'none'
}}
>

<li>
<button
onClick={toggleDarkMode}
className="p-2 rounded-full hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors"
aria-label="Toggle dark mode"
>
{darkMode ? (
<Sun className="h-5 w-5 text-gray-700 dark:text-gray-200" />
) : (
<Moon className="h-5 w-5 text-gray-700 dark:text-gray-200" />
)}
</button>
</li>
<li>
<HeaderLink
href="/docs"
Expand Down
Loading