feat(nav): Mode row in the sheet becomes icon-only with the bar's sun/moon

- Extract SunIcon/MoonIcon from the bar theme control into src/components/ui/icons.tsx
  (exact geometry and attributes, so the bar renders identically)
- MobileMenu Mode row: Dark option draws MoonIcon, Light draws SunIcon in the
  .mobile-menu-icon-option square the Language and Theme color rows use,
  aria-pressed + translated aria-label/title
- Delete .mobile-menu-segment-option (3 rule groups) from App.css — last user gone
- AGENTS.md picker paragraph, spec-v3-mobile-navigation.md (Q18 + progress row),
  spec-v3-i18n.md cross-reference updated
This commit is contained in:
dong.nguyen committed 2026-10-20 19:56:08 +07:00
1 parent 4d4fd066cc
commit 609067c6c9
7 files changed
+43 -42

No files matched your search

+3 -25
View File
@@ -274,31 +274,9 @@
gap: 8px;
}
.mobile-menu-segment-option {
min-height: 44px;
padding: 8px 16px;
border: 1px solid var(--border-strong);
border-radius: var(--radius-md);
background: none;
color: var(--text-secondary);
cursor: pointer;
transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}
.mobile-menu-segment-option.active {
background: var(--bg-elevated);
border-color: var(--accent);
color: var(--text-primary);
}
.mobile-menu-segment-option:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
/* Icon-only options in the sheet share this shape — the segmented row's 44px target, border and
radius — for the Theme color dots (.nav-palette-preview) and the Language globe/flag. The Mode
row keeps .mobile-menu-segment-option, because its options are words. */
/* Icon-only options in the sheet share this shape — the 44px target, border and radius — for
the Theme color dots (.nav-palette-preview), the Language globe/flag, and the Mode row's
sun/moon, which is the same line art the bar's theme control draws. */
.mobile-menu-icon-option {
display: flex;
align-items: center;
+12 -4
View File
@@ -9,6 +9,7 @@ import { strings } from '@/i18n/strings'
import { RollingTextLink } from '@/components/ui/RollingTextLink'
import { SocialLinks } from '@/components/ui/SocialLinks'
import { LanguageIcon } from '@/components/ui/LanguageIcon'
import { MoonIcon, SunIcon } from '@/components/ui/icons'
interface MobileMenuProps {
open: boolean
@@ -102,21 +103,28 @@ export function MobileMenu({ open, onClose }: MobileMenuProps) {
<div className="mobile-menu-segment">
<span className="mobile-menu-segment-label">{strings.nav.themeGroup[lang]}</span>
<div className="mobile-menu-segment-options" role="group" aria-label={strings.nav.themeGroup[lang]}>
{/* Icons, not words — the bar's own line art: moon for dark, sun for light.
An icon alone cannot name a mode, so each option carries the translated
mode name in aria-label and title. */}
<button
type="button"
className={resolvedTheme === 'dark' ? 'mobile-menu-segment-option active' : 'mobile-menu-segment-option'}
className={resolvedTheme === 'dark' ? 'mobile-menu-icon-option active' : 'mobile-menu-icon-option'}
aria-pressed={resolvedTheme === 'dark'}
aria-label={strings.nav.themeDark[lang]}
title={strings.nav.themeDark[lang]}
onClick={() => setTheme('dark')}
>
{strings.nav.themeDark[lang]}
<MoonIcon />
</button>
<button
type="button"
className={resolvedTheme === 'light' ? 'mobile-menu-segment-option active' : 'mobile-menu-segment-option'}
className={resolvedTheme === 'light' ? 'mobile-menu-icon-option active' : 'mobile-menu-icon-option'}
aria-pressed={resolvedTheme === 'light'}
aria-label={strings.nav.themeLight[lang]}
title={strings.nav.themeLight[lang]}
onClick={() => setTheme('light')}
>
{strings.nav.themeLight[lang]}
<SunIcon />
</button>
</div>
</div>
+2 -10
View File
@@ -8,6 +8,7 @@ import { navPaths } from '@/data/navigation'
import { RollingTextLink } from '@/components/ui/RollingTextLink'
import { ThemePaletteMenu } from '@/components/layout/ThemePaletteMenu'
import { LanguageIcon } from '@/components/ui/LanguageIcon'
import { MoonIcon, SunIcon } from '@/components/ui/icons'
import { MobileMenu } from '@/components/layout/MobileMenu'
import { ResumeNavButton } from '@/components/layout/ResumeNavButton'
@@ -150,16 +151,7 @@ export function Navigation() {
aria-label={`${strings.nav.themeSwitch[lang]} (${resolvedTheme === 'dark' ? strings.nav.themeDark[lang] : strings.nav.themeLight[lang]})`}
title={`${strings.nav.themeMode[lang]}: ${resolvedTheme === 'dark' ? strings.nav.themeDark[lang] : strings.nav.themeLight[lang]}`}
>
{resolvedTheme === 'dark' ? (
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<circle cx="12" cy="12" r="5" />
<path d="M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42" />
</svg>
) : (
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
</svg>
)}
{resolvedTheme === 'dark' ? <SunIcon /> : <MoonIcon />}
</button>
<ThemePaletteMenu />
+20
View File
@@ -63,3 +63,23 @@ export function ResumeIcon({ size = 20 }: IconProps) {
</svg>
)
}
// Mode glyphs — the bar's theme control and the sheet's Mode row share these two shapes.
// The sun means "switch to light", the moon "switch to dark". They keep the bar's original
// square caps, so extracting them changed nothing on the bar.
export function SunIcon({ size = 20 }: IconProps) {
return (
<svg viewBox="0 0 24 24" width={size} height={size} aria-hidden="true" fill="none" stroke="currentColor" strokeWidth={2}>
<circle cx="12" cy="12" r="5" />
<path d="M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42" />
</svg>
)
}
export function MoonIcon({ size = 20 }: IconProps) {
return (
<svg viewBox="0 0 24 24" width={size} height={size} aria-hidden="true" fill="none" stroke="currentColor" strokeWidth={2}>
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
</svg>
)
}