From 81d0964507988fad41073e537e358ebf9f09dbfa Mon Sep 17 00:00:00 2001 From: Piotr Monwid-Olechnowicz Date: Mon, 3 Nov 2025 17:29:22 +0100 Subject: [PATCH] Use new styles from Figma for the color mode switch --- .../_design-system/pixelarticons/moon.svg | 4 +- .../conf/_design-system/pixelarticons/sun.svg | 4 +- .../_design-system/pixelarticons/system.svg | 6 ++- src/components/theme-switch.tsx | 45 +++++++++++-------- 4 files changed, 33 insertions(+), 26 deletions(-) diff --git a/src/app/conf/_design-system/pixelarticons/moon.svg b/src/app/conf/_design-system/pixelarticons/moon.svg index c1529d535a..4407b845a4 100644 --- a/src/app/conf/_design-system/pixelarticons/moon.svg +++ b/src/app/conf/_design-system/pixelarticons/moon.svg @@ -1,7 +1,5 @@ diff --git a/src/app/conf/_design-system/pixelarticons/sun.svg b/src/app/conf/_design-system/pixelarticons/sun.svg index c2eb3aae94..5094c705ef 100644 --- a/src/app/conf/_design-system/pixelarticons/sun.svg +++ b/src/app/conf/_design-system/pixelarticons/sun.svg @@ -1,7 +1,7 @@ - + diff --git a/src/app/conf/_design-system/pixelarticons/system.svg b/src/app/conf/_design-system/pixelarticons/system.svg index 3121ba395c..694451553a 100644 --- a/src/app/conf/_design-system/pixelarticons/system.svg +++ b/src/app/conf/_design-system/pixelarticons/system.svg @@ -1,3 +1,5 @@ - - + + diff --git a/src/components/theme-switch.tsx b/src/components/theme-switch.tsx index cddb11be3f..903a0b6a4b 100644 --- a/src/components/theme-switch.tsx +++ b/src/components/theme-switch.tsx @@ -9,6 +9,7 @@ import { useMounted } from "nextra/hooks" import MoonIcon from "@/app/conf/_design-system/pixelarticons/moon.svg?svgr" import SunIcon from "@/app/conf/_design-system/pixelarticons/sun.svg?svgr" import SystemIcon from "@/app/conf/_design-system/pixelarticons/system.svg?svgr" +import CheckIcon from "@/app/conf/_design-system/pixelarticons/check.svg?svgr" const THEME_OPTIONS = ["light", "dark", "system"] as const export type ThemeOption = (typeof THEME_OPTIONS)[number] @@ -49,41 +50,47 @@ export function ThemeSwitch({ lite, className }: ThemeSwitchProps) { aria-label="Change theme" title="Change theme" className={clsx( - "gql-focus-visible -m-2 flex cursor-pointer items-center gap-2 p-2 text-neu-800 transition-colors hover:bg-neu-50 hover:text-neu-900 focus-visible:!-outline-offset-2 dark:text-neu-700 dark:hover:bg-neu-50/50", + "gql-focus-visible relative cursor-pointer text-neu-800 transition-colors before:absolute before:-inset-2 hover:bg-neu-100 hover:text-neu-900 focus-visible:!-outline-offset-2 dark:text-neu-700 dark:hover:bg-neu-50/50", className, )} > - - +
+ + +
- - + + {THEME_OPTIONS.map(option => { const Icon = OPTION_ICONS[option] - const isSystem = Icon === SystemIcon return ( - + {option} + ) })}