@@ -9,6 +9,7 @@ import { useMounted } from "nextra/hooks"
99import MoonIcon from "@/app/conf/_design-system/pixelarticons/moon.svg?svgr"
1010import SunIcon from "@/app/conf/_design-system/pixelarticons/sun.svg?svgr"
1111import SystemIcon from "@/app/conf/_design-system/pixelarticons/system.svg?svgr"
12+ import CheckIcon from "@/app/conf/_design-system/pixelarticons/check.svg?svgr"
1213
1314const THEME_OPTIONS = [ "light" , "dark" , "system" ] as const
1415export type ThemeOption = ( typeof THEME_OPTIONS ) [ number ]
@@ -49,41 +50,47 @@ export function ThemeSwitch({ lite, className }: ThemeSwitchProps) {
4950 aria-label = "Change theme"
5051 title = "Change theme"
5152 className = { clsx (
52- "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" ,
53+ "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" ,
5354 className ,
5455 ) }
5556 >
56- < ResolvedThemeIcon height = "16" />
57- < Select . Value
58- className = { clsx (
59- "text-sm capitalize leading-none" ,
60- lite ? "sr-only" : "text-neu-700" ,
61- ) }
62- />
57+ < div className = "flex items-center gap-2 border border-transparent p-[5px] [[aria-expanded=true]>&]:border-neu-300 [[aria-expanded=true]>&]:bg-neu-0 [[aria-expanded=true]>&]:dark:border-neu-100" >
58+ < ResolvedThemeIcon height = "16" />
59+ < Select . Value
60+ className = { clsx (
61+ "text-sm capitalize leading-none" ,
62+ lite ? "sr-only" : "text-neu-800" ,
63+ ) }
64+ />
65+ </ div >
6366 </ Select . Trigger >
6467 < Select . Portal >
65- < Select . Positioner className = "z-20 outline-none" sideOffset = { 4 } >
66- < Select . Popup className = "min-w-[var(--anchor-width)] border border-neu-200 bg-[rgb(var(--nextra-bg))] p-1 text-neu-900 shadow-md outline-none dark:border-neu-100" >
68+ < Select . Positioner
69+ className = "z-20 outline-none"
70+ align = "end"
71+ sideOffset = { 4 }
72+ >
73+ < Select . Popup className = "w-[120px] min-w-[var(--anchor-width)] border border-neu-200 bg-[rgb(var(--nextra-bg))] bg-neu-0 text-neu-900 shadow-sm outline-none dark:border-neu-100" >
6774 < Select . List >
6875 { THEME_OPTIONS . map ( option => {
6976 const Icon = OPTION_ICONS [ option ]
70- const isSystem = Icon === SystemIcon
7177 return (
7278 < Select . Item
7379 key = { option }
7480 value = { option }
75- className = "mt-px flex cursor-pointer items-center gap-2 px-3 py-1.5 text-neu-800 first:mt-0 focus-visible:outline-none focus-visible:ring-0 data-[highlighted]:bg-neu-100 data-[highlighted]:text-neu-900 data-[selected]:text-neu-600 dark:text-neu-700 dark:data-[highlighted]:bg-neu-50"
81+ style = { {
82+ paddingBlock : lite ? "10px" : "9px" ,
83+ } }
84+ className = "mt-px flex cursor-pointer items-center gap-2 px-2 text-xs text-neu-800 first:mt-0 focus-visible:outline-none focus-visible:ring-0 data-[highlighted]:bg-neu-100 data-[highlighted]:text-neu-900 dark:text-neu-700 dark:data-[highlighted]:bg-neu-50/50"
7685 >
77- < Icon
78- height = {
79- // the icons are not fully proportional
80- isSystem ? "18" : "16"
81- }
82- className = { isSystem ? "-mr-0.5 -translate-x-px" : "" }
83- />
86+ < Icon height = { 14 } />
8487 < Select . ItemText className = "capitalize leading-none" >
8588 { option }
8689 </ Select . ItemText >
90+ < CheckIcon
91+ height = { 16 }
92+ className = "ml-auto hidden text-pri-base dark:text-pri-light [[data-selected]_&]:block"
93+ />
8794 </ Select . Item >
8895 )
8996 } ) }
0 commit comments