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

+1 -1
View File
@@ -59,7 +59,7 @@ Personal engineering portfolio — multi-page SPA built with React + TypeScript
- `data-palette` attribute + `localStorage` key `portfolio-palette`; `index.html`'s init script writes both attributes before paint - `data-palette` attribute + `localStorage` key `portfolio-palette`; `index.html`'s init script writes both attributes before paint
- Palette overrides in `src/index.css` are `:root[data-theme='dark'][data-palette='blue']` / `:root[data-theme='light'][data-palette='blue']` (specificity 0,3,0 — they beat the base blocks regardless of order); no blue variant exists in the `prefers-color-scheme` bridge, because the init script always writes `data-palette` - Palette overrides in `src/index.css` are `:root[data-theme='dark'][data-palette='blue']` / `:root[data-theme='light'][data-palette='blue']` (specificity 0,3,0 — they beat the base blocks regardless of order); no blue variant exists in the `prefers-color-scheme` bridge, because the init script always writes `data-palette`
- Accent has two tiers: `--accent` / `--accent-hover` / `--accent-active` are the bright signal colours (links, underlines, borders, glows) and the fill of the pale accent surfaces (palette-option hover, `.tag-accent`, `.back-to-top`, resume summary bar); `--accent-solid` / `-hover` / `-active` plus `--text-on-accent-solid` are the deeper fill and light text used by `.btn-primary` and `.badge-accent`, which is what lets a dark-mode button carry light text. The solid family is declared in all five blocks of `src/index.css` (dark red, light red, dark blue, light blue, the `prefers-color-scheme` bridge); the two light blocks duplicate the plain accent values verbatim, so light mode does not move. Spec: `docs/design/specs/v3/spec-v3-nav-cta-enhancements.md` - Accent has two tiers: `--accent` / `--accent-hover` / `--accent-active` are the bright signal colours (links, underlines, borders, glows) and the fill of the pale accent surfaces (palette-option hover, `.tag-accent`, `.back-to-top`, resume summary bar); `--accent-solid` / `-hover` / `-active` plus `--text-on-accent-solid` are the deeper fill and light text used by `.btn-primary` and `.badge-accent`, which is what lets a dark-mode button carry light text. The solid family is declared in all five blocks of `src/index.css` (dark red, light red, dark blue, light blue, the `prefers-color-scheme` bridge); the two light blocks duplicate the plain accent values verbatim, so light mode does not move. Spec: `docs/design/specs/v3/spec-v3-nav-cta-enhancements.md`
- Picker, two renderings, both present at every width: the bar uses `src/components/layout/ThemePaletteMenu.tsx` — icon-only trigger (`nav-control nav-palette-trigger`, a 20px half-circle swatch: active palette's accent on the left, `--swatch-empty` on the right; no text, no chevron; the name lives in `aria-label`, the hint in `title`) opening the `#palette-menu` panel. The sheet renders its own Theme color row inside `MobileMenu.tsx` from `paletteIds` + `paletteMeta` as `.mobile-menu-icon-option` buttons — the 44px icon-only square the Language row shares; the Mode row keeps `.mobile-menu-segment-option`, because its options are words. `ThemePaletteMenu` has no `variant` prop and is never mounted in the sheet - Picker, two renderings, both present at every width: the bar uses `src/components/layout/ThemePaletteMenu.tsx` — icon-only trigger (`nav-control nav-palette-trigger`, a 20px half-circle swatch: active palette's accent on the left, `--swatch-empty` on the right; no text, no chevron; the name lives in `aria-label`, the hint in `title`) opening the `#palette-menu` panel. The sheet renders its own Theme color row inside `MobileMenu.tsx` from `paletteIds` + `paletteMeta` as `.mobile-menu-icon-option` buttons — the 44px icon-only square the Language row shares; the Mode row renders the same squares with the bar's own mode line art — `MoonIcon` for dark, `SunIcon` for light, both from `src/components/ui/icons.tsx` and shared with the bar's theme control — each option naming its mode in `aria-label`/`title`. `ThemePaletteMenu` has no `variant` prop and is never mounted in the sheet
- Preview chips are theme-aware: `--preview-red-accent` / `--preview-blue-accent` are declared per theme — `:root` dark pair, `:root[data-theme='light']` light pair, repeated in the `prefers-color-scheme` bridge — and mirror that block's `--accent`, so a submenu dot and the bar swatch's accent half are the same colour in the same theme. Each chip names its own palette through `data-preview`, so the two `[data-palette='blue']` blocks declare no preview token; `--swatch-empty` stays one constant. Spec: `docs/design/specs/v3/spec-v3-nav-swatch-and-hamburger.md` - Preview chips are theme-aware: `--preview-red-accent` / `--preview-blue-accent` are declared per theme — `:root` dark pair, `:root[data-theme='light']` light pair, repeated in the `prefers-color-scheme` bridge — and mirror that block's `--accent`, so a submenu dot and the bar swatch's accent half are the same colour in the same theme. Each chip names its own palette through `data-preview`, so the two `[data-palette='blue']` blocks declare no preview token; `--swatch-empty` stays one constant. Spec: `docs/design/specs/v3/spec-v3-nav-swatch-and-hamburger.md`
- Bar controls share one chrome: `.nav-control` covers the language toggle, the mode toggle and the palette trigger (44px bordered box, accent border + icon on hover/open, one `:focus-visible`). The hamburger leads the bar at every width it appears: `.nav-brand` (`display: flex; gap: 4px` — its icons carry no borders, so the spacing reads between glyphs: 4px between 44px targets is 24px between the 24px glyphs, a tight brand cluster while hover fills and 2px-offset focus rings stay clear) holds it first and the brand home icon right after, at the bar's left edge — `.nav-logo` is a 24px stroke house in a 44px target, a `<Link to="/">` named by the translated `strings.nav.home` label with the svg `aria-hidden`, so it carries its own `:focus-visible` ring. Third in the brand group is the resume entry — `src/components/layout/ResumeNavButton.tsx`, a `nav-control nav-resume-trigger` 44px target that **carries no border** (`border-color: transparent` at rest, on hover and while open, because it sits beside the borderless home icon; the hover fill and the `:focus-visible` ring stay; its glyph is `--accent` at every state — rest, hover, open — so the entry always carries the active theme's signal colour and follows the palette switch), holding `ResumeIcon size={24}` — the same 24px the home glyph beside it uses, so the two brand icons share a size inside their 44px targets — the resume document glyph from `public/cv-icon.svg`, the owner's 30-grid CV artwork adapted to the bar's 24-grid (spec follow-up 19): a page outline split on the left edge by a visible dash (`M14 2 H6 a2 2 0 0 0 -2 2 V6` + `M4 10 V12` + `M4 16 v4 a2 2 0 0 0 2 2 h12 a2 2 0 0 0 2 -2 V8 L14 2`; 4px endpoint gaps stay open under 2px round caps), a folded corner (`M14 2 v4 a2 2 0 0 0 2 2 h4`), and stroked CV lettering replacing the content lines (`M9.5 12 A3 3 0 0 0 9.5 18` + `M12.5 12 L15 18 L17.5 12`), in the bar's 2px stroke language; at 1:1 the strokes are exactly 2px and the lettering reads clearly in both themes. Named by `strings.nav.resume`, `aria-haspopup="dialog"` on its own `#resume-modal-nav`; `.nav-resume` is the wrapper that ties trigger to dialog and is what `useClickOutside` watches. `.nav-actions` then carries the three appearance controls in that order (language, mode, theme color) at the right end, their bordered boxes keeping the 16px gap. The sheet's Appearance group follows the same order (Language row, Mode row, Theme color row). Six controls now share the bar at ≤1024px: `@media (max-width: 420px)` keeps 16px padding and drops only the action gap to 8px — the brand group stays at 4px at every width — `@media (max-width: 360px)` drops the padding to 12px — 40 + 44×5 = 260px of controls plus 2×4px brand gaps plus 2×8px action gaps = 284px inside 296px, and every target stays 44px - Bar controls share one chrome: `.nav-control` covers the language toggle, the mode toggle and the palette trigger (44px bordered box, accent border + icon on hover/open, one `:focus-visible`). The hamburger leads the bar at every width it appears: `.nav-brand` (`display: flex; gap: 4px` — its icons carry no borders, so the spacing reads between glyphs: 4px between 44px targets is 24px between the 24px glyphs, a tight brand cluster while hover fills and 2px-offset focus rings stay clear) holds it first and the brand home icon right after, at the bar's left edge — `.nav-logo` is a 24px stroke house in a 44px target, a `<Link to="/">` named by the translated `strings.nav.home` label with the svg `aria-hidden`, so it carries its own `:focus-visible` ring. Third in the brand group is the resume entry — `src/components/layout/ResumeNavButton.tsx`, a `nav-control nav-resume-trigger` 44px target that **carries no border** (`border-color: transparent` at rest, on hover and while open, because it sits beside the borderless home icon; the hover fill and the `:focus-visible` ring stay; its glyph is `--accent` at every state — rest, hover, open — so the entry always carries the active theme's signal colour and follows the palette switch), holding `ResumeIcon size={24}` — the same 24px the home glyph beside it uses, so the two brand icons share a size inside their 44px targets — the resume document glyph from `public/cv-icon.svg`, the owner's 30-grid CV artwork adapted to the bar's 24-grid (spec follow-up 19): a page outline split on the left edge by a visible dash (`M14 2 H6 a2 2 0 0 0 -2 2 V6` + `M4 10 V12` + `M4 16 v4 a2 2 0 0 0 2 2 h12 a2 2 0 0 0 2 -2 V8 L14 2`; 4px endpoint gaps stay open under 2px round caps), a folded corner (`M14 2 v4 a2 2 0 0 0 2 2 h4`), and stroked CV lettering replacing the content lines (`M9.5 12 A3 3 0 0 0 9.5 18` + `M12.5 12 L15 18 L17.5 12`), in the bar's 2px stroke language; at 1:1 the strokes are exactly 2px and the lettering reads clearly in both themes. Named by `strings.nav.resume`, `aria-haspopup="dialog"` on its own `#resume-modal-nav`; `.nav-resume` is the wrapper that ties trigger to dialog and is what `useClickOutside` watches. `.nav-actions` then carries the three appearance controls in that order (language, mode, theme color) at the right end, their bordered boxes keeping the 16px gap. The sheet's Appearance group follows the same order (Language row, Mode row, Theme color row). Six controls now share the bar at ≤1024px: `@media (max-width: 420px)` keeps 16px padding and drops only the action gap to 8px — the brand group stays at 4px at every width — `@media (max-width: 360px)` drops the padding to 12px — 40 + 44×5 = 260px of controls plus 2×4px brand gaps plus 2×8px action gaps = 284px inside 296px, and every target stays 44px
- Language control is icon-only in both renderings — `src/components/ui/LanguageIcon.tsx` draws both languages as line art in the bar's stroke language (`currentColor`, no fills): English a 20px globe (circle r=10 + equator + meridian ellipse, 2px round joins, so it follows the control's hover accent), Tiếng Việt a flag outline (21×17.5 band `rx=2` at 1.5/3.25 — drawn 23×19.5 against the globe's 22×22; width is already at the limit, so the size step came from height, which drags the constitutional 2:3 to 1.2 — with a centred five-point mullet at r=3.6, deliberately smaller than the flag's own 0.6 × height construction, stroked 1.5px round joins so its interior stays open). The bar's `nav-control lang-toggle` shows the language it switches TO (`lang === 'en' ? 'vi' : 'en'`): translated action in `aria-label`, the target's own-language name in `title`. `.lang-toggle` now carries no CSS rules of its own — it marks the button in the DOM and nothing else. The sheet's Language row uses `.mobile-menu-icon-option` squares with `aria-pressed` and the own-language `aria-label` / `title`. Spec: `docs/design/specs/v3/spec-v3-i18n.md` - Language control is icon-only in both renderings — `src/components/ui/LanguageIcon.tsx` draws both languages as line art in the bar's stroke language (`currentColor`, no fills): English a 20px globe (circle r=10 + equator + meridian ellipse, 2px round joins, so it follows the control's hover accent), Tiếng Việt a flag outline (21×17.5 band `rx=2` at 1.5/3.25 — drawn 23×19.5 against the globe's 22×22; width is already at the limit, so the size step came from height, which drags the constitutional 2:3 to 1.2 — with a centred five-point mullet at r=3.6, deliberately smaller than the flag's own 0.6 × height construction, stroked 1.5px round joins so its interior stays open). The bar's `nav-control lang-toggle` shows the language it switches TO (`lang === 'en' ? 'vi' : 'en'`): translated action in `aria-label`, the target's own-language name in `title`. `.lang-toggle` now carries no CSS rules of its own — it marks the button in the DOM and nothing else. The sheet's Language row uses `.mobile-menu-icon-option` squares with `aria-pressed` and the own-language `aria-label` / `title`. Spec: `docs/design/specs/v3/spec-v3-i18n.md`
+3 -2
View File
@@ -442,8 +442,9 @@ switches TO — the same contract the old glyph had.
| CSS | `.nav-control` chrome only; `.lang-toggle` carries no rules of its own — it marks the button in the DOM | | CSS | `.nav-control` chrome only; `.lang-toggle` carries no rules of its own — it marks the button in the DOM |
**Sheet** (`src/components/layout/MobileMenu.tsx`): the Language row's two options are **Sheet** (`src/components/layout/MobileMenu.tsx`): the Language row's two options are
`.mobile-menu-icon-option` — the 44px icon-only square the Theme color row uses. The Mode row keeps `.mobile-menu-icon-option` — the 44px icon-only square the Theme color and Mode rows use as
`.mobile-menu-segment-option`, because its options are words. Each option carries `aria-pressed` and well (the Mode row's word options and `.mobile-menu-segment-option` were retired 2026-10-20,
see `spec-v3-mobile-navigation.md` Q18). Each option carries `aria-pressed` and
its own-language name in `aria-label` and `title`: an icon alone cannot say which language it is. its own-language name in `aria-label` and `title`: an icon alone cannot say which language it is.
`langEn` / `langVi` stay flat `{en, vi}` records. A nested `langName: { en: …, vi: … }` record inside `langEn` / `langVi` stay flat `{en, vi}` records. A nested `langName: { en: …, vi: … }` record inside
@@ -794,6 +794,7 @@ Nothing deprecated or aliased: `SocialLinks` keeps its name and barrel export; i
| Q15 | Post-build, a third time: the order of the three appearance controls | **Mode, Theme, Language — Language moves to the end in the bar *and* in the sheet** | Supersedes Q12. Bar `.nav-actions`: mode toggle → `ThemePaletteMenu` → language toggle → hamburger (`Navigation.tsx:84-111`). Sheet Appearance group: Mode row → Theme color row → Language row (`MobileMenu.tsx:71-132`). §3.1 anatomy, §3.4, §11, `spec-ui-layout.md` and `AGENTS.md` updated. Height arithmetic unchanged — the same three 48px segments in a new order, so the 647px total and the §3.3 device table still hold. **Superseded by Q16 below** | | Q15 | Post-build, a third time: the order of the three appearance controls | **Mode, Theme, Language — Language moves to the end in the bar *and* in the sheet** | Supersedes Q12. Bar `.nav-actions`: mode toggle → `ThemePaletteMenu` → language toggle → hamburger (`Navigation.tsx:84-111`). Sheet Appearance group: Mode row → Theme color row → Language row (`MobileMenu.tsx:71-132`). §3.1 anatomy, §3.4, §11, `spec-ui-layout.md` and `AGENTS.md` updated. Height arithmetic unchanged — the same three 48px segments in a new order, so the 647px total and the §3.3 device table still hold. **Superseded by Q16 below** |
| Q16 | Order, a fourth time: which control leads | **Language first** — Language → Mode → Theme in the bar *and* in the sheet; the hamburger stays last in the bar | Supersedes Q15. Bar `.nav-actions`: language toggle → mode toggle → `ThemePaletteMenu` → hamburger (`Navigation.tsx:84-111`). Sheet Appearance group: Language row (`:71-91`) → Mode row (`:93-113`) → Theme color row (`:115-132`) in `MobileMenu.tsx`. §3.1 anatomy, §3.4, §9's smoke row, §11, `spec-ui-layout.md`, `AGENTS.md` and `spec-v3-theme-palette-switch.md` updated. Markup-only again — no CSS rule keys off child order (`.nav-actions` is a flex row with a gap, the segments are block rows), so the 320px arithmetic and the 647px sheet height are unchanged | | Q16 | Order, a fourth time: which control leads | **Language first** — Language → Mode → Theme in the bar *and* in the sheet; the hamburger stays last in the bar | Supersedes Q15. Bar `.nav-actions`: language toggle → mode toggle → `ThemePaletteMenu` → hamburger (`Navigation.tsx:84-111`). Sheet Appearance group: Language row (`:71-91`) → Mode row (`:93-113`) → Theme color row (`:115-132`) in `MobileMenu.tsx`. §3.1 anatomy, §3.4, §9's smoke row, §11, `spec-ui-layout.md`, `AGENTS.md` and `spec-v3-theme-palette-switch.md` updated. Markup-only again — no CSS rule keys off child order (`.nav-actions` is a flex row with a gap, the segments are block rows), so the 320px arithmetic and the 647px sheet height are unchanged |
| Q17 | Post-build, a fifth time — raised in `spec-v3-nav-swatch-and-hamburger.md` §1, 2026-10-17 | **The hamburger moves to the LEFT of the bar.** The owner is left-handed and reaches the left end of a handheld bar more easily | Supersedes only the "the hamburger stays last in the bar" half of Q16; the language → mode → theme color order survives unchanged. `Navigation.tsx:59-102` now opens `.nav-container` with a `.nav-brand` group — hamburger then logo — and `.nav-actions` (`:122-151`) holds exactly the three appearance controls. `src/App.css:32-39` adds `.nav-brand` (flex, 12px gap; 8px at ≤420px). DOM order == visual order == Tab order, which is why a `display: contents` + `order: -1` CSS-only variant was rejected. Row arithmetic re-measured: 40 + 12 + 70 + 44×3 + 12×2 = 278px inside 288px at 320px (14px slack with the 8px brand gap); the "262px / 26px slack" comment in `src/App.css` was arithmetically wrong and is corrected. The sheet, its group order and its 647px height are untouched | | Q17 | Post-build, a fifth time — raised in `spec-v3-nav-swatch-and-hamburger.md` §1, 2026-10-17 | **The hamburger moves to the LEFT of the bar.** The owner is left-handed and reaches the left end of a handheld bar more easily | Supersedes only the "the hamburger stays last in the bar" half of Q16; the language → mode → theme color order survives unchanged. `Navigation.tsx:59-102` now opens `.nav-container` with a `.nav-brand` group — hamburger then logo — and `.nav-actions` (`:122-151`) holds exactly the three appearance controls. `src/App.css:32-39` adds `.nav-brand` (flex, 12px gap; 8px at ≤420px). DOM order == visual order == Tab order, which is why a `display: contents` + `order: -1` CSS-only variant was rejected. Row arithmetic re-measured: 40 + 12 + 70 + 44×3 + 12×2 = 278px inside 288px at 320px (14px slack with the 8px brand gap); the "262px / 26px slack" comment in `src/App.css` was arithmetically wrong and is corrected. The sheet, its group order and its 647px height are untouched |
| Q18 | 2026-10-20: the Mode row is the only Appearance row still drawing words ("Dark" / "Light") | **The Mode row becomes icon-only too — the bar's own sun/moon line art** | `SunIcon`/`MoonIcon` extracted from the bar's theme control into `src/components/ui/icons.tsx` (geometry and attributes unchanged — square caps, so the bar renders identically) and shared: the sheet's Dark option draws `MoonIcon`, Light draws `SunIcon`, in the `.mobile-menu-icon-option` square the Language and Theme color rows use, with `aria-pressed` and the translated mode name in `aria-label`/`title` (`strings.nav.themeDark`/`themeLight` unchanged — the bar's labels still use them). `.mobile-menu-segment-option` (base, `.active`, `:focus-visible`) deleted from `src/App.css` — the Mode row was its last user. Row heights unchanged (44px either way), so the sheet's totals and device table still hold. `AGENTS.md`'s picker paragraph and `spec-v3-i18n.md`'s cross-reference corrected |
--- ---
@@ -861,6 +862,7 @@ Eleven criteria are proven by the automated checks in §12 and three more (the 2
| Owner browser pass | TODO | | Owner browser pass | TODO |
| Owner follow-up Q17 — hamburger to the left of the bar | DONE 2026-10-17 — `Navigation.tsx:59-102` (`.nav-brand` group: trigger then logo), `src/App.css:32-39` (`.nav-brand` rule) and `:319-334` (≤420px guard gains `.nav-brand { gap: 8px }` plus the corrected arithmetic comment); `AGENTS.md:61` and `spec-ui-layout.md:103,106,114` corrected. Full record in `specs/v3/spec-v3-nav-swatch-and-hamburger.md` §11 | | Owner follow-up Q17 — hamburger to the left of the bar | DONE 2026-10-17 — `Navigation.tsx:59-102` (`.nav-brand` group: trigger then logo), `src/App.css:32-39` (`.nav-brand` rule) and `:319-334` (≤420px guard gains `.nav-brand { gap: 8px }` plus the corrected arithmetic comment); `AGENTS.md:61` and `spec-ui-layout.md:103,106,114` corrected. Full record in `specs/v3/spec-v3-nav-swatch-and-hamburger.md` §11 |
| Owner follow-up — the brand becomes a home icon | DONE 2026-10-17 — `Navigation.tsx:97-106`, `src/App.css:25-36`, `:47-55`, `:319-330`. The `{CV}` in the §3.1 ASCII anatomy above now reads as a house glyph; the wordmark's two spans and their CSS are deleted. Full record in `spec-v3-nav-swatch-and-hamburger.md` §11 | | Owner follow-up — the brand becomes a home icon | DONE 2026-10-17 — `Navigation.tsx:97-106`, `src/App.css:25-36`, `:47-55`, `:319-330`. The `{CV}` in the §3.1 ASCII anatomy above now reads as a house glyph; the wordmark's two spans and their CSS are deleted. Full record in `spec-v3-nav-swatch-and-hamburger.md` §11 |
| Owner follow-up Q18 — Mode row as icon-only options (2026-10-20) | DONE — `src/components/ui/icons.tsx` gains `SunIcon`/`MoonIcon` (the bar theme control's exact geometry, extracted); `Navigation.tsx` theme button now renders `<SunIcon />` / `<MoonIcon />` (identical rendering); `MobileMenu.tsx` Mode row renders `.mobile-menu-icon-option` squares with `MoonIcon` (dark) / `SunIcon` (light), `aria-pressed` + translated `aria-label`/`title`; `.mobile-menu-segment-option` (3 rule groups) deleted from `src/App.css`; `AGENTS.md` picker paragraph and `spec-v3-i18n.md` cross-reference corrected. `tsc -b` exit 0, oxlint unchanged (4 pre-existing warnings). Sheet height and row arithmetic unchanged — 44px options either way; visual check in the owner's browser |
--- ---
+3 -25
View File
@@ -274,31 +274,9 @@
gap: 8px; gap: 8px;
} }
.mobile-menu-segment-option { /* Icon-only options in the sheet share this shape — the 44px target, border and radius — for
min-height: 44px; the Theme color dots (.nav-palette-preview), the Language globe/flag, and the Mode row's
padding: 8px 16px; sun/moon, which is the same line art the bar's theme control draws. */
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. */
.mobile-menu-icon-option { .mobile-menu-icon-option {
display: flex; display: flex;
align-items: center; align-items: center;
+12 -4
View File
@@ -9,6 +9,7 @@ import { strings } from '@/i18n/strings'
import { RollingTextLink } from '@/components/ui/RollingTextLink' import { RollingTextLink } from '@/components/ui/RollingTextLink'
import { SocialLinks } from '@/components/ui/SocialLinks' import { SocialLinks } from '@/components/ui/SocialLinks'
import { LanguageIcon } from '@/components/ui/LanguageIcon' import { LanguageIcon } from '@/components/ui/LanguageIcon'
import { MoonIcon, SunIcon } from '@/components/ui/icons'
interface MobileMenuProps { interface MobileMenuProps {
open: boolean open: boolean
@@ -102,21 +103,28 @@ export function MobileMenu({ open, onClose }: MobileMenuProps) {
<div className="mobile-menu-segment"> <div className="mobile-menu-segment">
<span className="mobile-menu-segment-label">{strings.nav.themeGroup[lang]}</span> <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]}> <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 <button
type="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-pressed={resolvedTheme === 'dark'}
aria-label={strings.nav.themeDark[lang]}
title={strings.nav.themeDark[lang]}
onClick={() => setTheme('dark')} onClick={() => setTheme('dark')}
> >
{strings.nav.themeDark[lang]} <MoonIcon />
</button> </button>
<button <button
type="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-pressed={resolvedTheme === 'light'}
aria-label={strings.nav.themeLight[lang]}
title={strings.nav.themeLight[lang]}
onClick={() => setTheme('light')} onClick={() => setTheme('light')}
> >
{strings.nav.themeLight[lang]} <SunIcon />
</button> </button>
</div> </div>
</div> </div>
+2 -10
View File
@@ -8,6 +8,7 @@ import { navPaths } from '@/data/navigation'
import { RollingTextLink } from '@/components/ui/RollingTextLink' import { RollingTextLink } from '@/components/ui/RollingTextLink'
import { ThemePaletteMenu } from '@/components/layout/ThemePaletteMenu' import { ThemePaletteMenu } from '@/components/layout/ThemePaletteMenu'
import { LanguageIcon } from '@/components/ui/LanguageIcon' import { LanguageIcon } from '@/components/ui/LanguageIcon'
import { MoonIcon, SunIcon } from '@/components/ui/icons'
import { MobileMenu } from '@/components/layout/MobileMenu' import { MobileMenu } from '@/components/layout/MobileMenu'
import { ResumeNavButton } from '@/components/layout/ResumeNavButton' 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]})`} 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]}`} title={`${strings.nav.themeMode[lang]}: ${resolvedTheme === 'dark' ? strings.nav.themeDark[lang] : strings.nav.themeLight[lang]}`}
> >
{resolvedTheme === 'dark' ? ( {resolvedTheme === 'dark' ? <SunIcon /> : <MoonIcon />}
<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>
)}
</button> </button>
<ThemePaletteMenu /> <ThemePaletteMenu />
+20
View File
@@ -63,3 +63,23 @@ export function ResumeIcon({ size = 20 }: IconProps) {
</svg> </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>
)
}