feat(nav): theme-aware palette previews, left-side hamburger, home icon brand

Preview chips now mirror the bar swatch: --preview-*-accent is declared per theme (dark #f87171/#60a5fa, light #b04138/#2563eb, repeated in the prefers-color-scheme bridge) and the two [data-palette=blue] blocks declare nothing, since a chip names its own palette through data-preview. --preview-*-bg is deleted; chips take the shared --border-strong hairline. Dark-mode dots move from 2.53/3.13 to 5.24/6.36 against their panel.

The hamburger leads the bar in a new .nav-brand group (trigger then brand), and the wordmark becomes a 24px stroke home icon in a 44px target with a :focus-visible ring, still a <Link to="/">. .logo-bracket/.logo-text are removed and the <=420px guard drops its brand-gap override: the row measures 252px inside 288px.

Docs: new specs/v3/spec-v3-nav-swatch-and-hamburger.md plus supersession notes in spec-v3-mobile-navigation, spec-v3-theme-palette-switch and spec-v3-ui-enhancements; AGENTS.md, spec-ui-layout and spec-ui-navigation updated. Gates: tsc+vite build exit 0, oxlint 15 findings (11 rules-of-hooks, unchanged baseline), zero hex in App.css, 12/12 SSR bar-order assertions.
This commit is contained in:
dong.nguyen committed 2026-10-17 22:33:42 +07:00
1 parent 4387f889f5
commit c95f7b09d1
10 files changed
+513 -74

No files matched your search

@@ -793,6 +793,7 @@ Nothing deprecated or aliased: `SocialLinks` keeps its name and barrel export; i
| Q14 | Post-build: what the bar looks like at ≤1024px | **Keep the palette control in the bar at every width, and give the three bar controls one shared chrome** | `ThemePaletteMenu`'s trigger becomes `nav-control nav-palette-trigger` and the chevron svg is deleted; `theme-toggle` and `lang-toggle` join `.nav-control` (`src/App.css:91-116`) — bordered 44px box, accent border + text on hover/open, one `:focus-visible` — leaving `.lang-toggle` only its 13px/600 glyph step (`:119-123`), which moved out of `src/index.css`. `.nav-palette-swatch` becomes a 20px half-circle: active palette's accent on the left, `--swatch-empty: #ffffff` on the right (`src/index.css:151`), so the icon reads in both themes. The ≤1024px `.nav-palette` hide rule added while wiring Q13 is deleted, and `@media (max-width: 420px)` (`src/App.css:305-313`) keeps logo + 4×44 + 3×12 = 262px inside 288px of content at 320px (§3.4). §3.1, §3.4, §7, §8, §9 and §11 updated |
| 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 |
| 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 |
---
@@ -804,6 +805,8 @@ Nothing deprecated or aliased: `SocialLinks` keeps its name and barrel export; i
- [ ] `role="dialog"` is honest: `aria-modal="true"`, focus into the sheet on open **on the panel itself (`tabIndex={-1}`) — never on a link, because `RollingTextLink` turns a focus event into its rolling-text animation**, back to the hamburger on close **when the hamburger is rendered**, `Escape` closes from any focus position (document-level listener), and `#main-content`, `.footer` **and `.back-to-top`** are `inert` while open.
- [x] Appearance group renders in this order (Q16): the English/Tiếng Việt segmented control, then the Dark/Light segmented control, then the Theme color row — a segmented row of colour-icon buttons (`paletteIds`, one per schema, since Q13); the bar carries the same order with the palette as an icon-only trigger — language toggle, mode toggle, palette icon, then the hamburger. Changing any one of them updates its twin, and no control holds local state.
- [x] The bar carries the palette control at every width, in the order language → mode → theme color → hamburger (Q16), with the three controls sharing one `.nav-control` chrome (44px bordered box, accent border + text on hover/open, a single `:focus-visible` rule); the trigger is the 20px half-circle swatch — no text, no chevron — named by `aria-label` ("Theme: Red") with `title` ("Switch theme color"). `@media (max-width: 420px)` keeps that row inside 320px. Proven by the §9 SSR bar assertions
- [x] Bar anatomy since Q17 (`specs/v3/spec-v3-nav-swatch-and-hamburger.md`): `.nav-brand` opens the bar with the hamburger at the left edge and the `{CV}` brand immediately right of it; `.nav-actions` carries language → mode → theme color at the right end, and `#palette-menu` still anchors `right: 0` under its trigger. Tab order matches visual order. Proven by that spec's §9 SSR bar-order assertions — **supersedes the hamburger-last clause of the Q16 row above**
- [x] Brand since 2026-10-17: the bar's left cluster is the hamburger then a 24px **home icon** in a 44px `.nav-logo` target — still `<Link to="/">` with the translated Home label as `aria-label` and the svg `aria-hidden`; the `{CV}` wordmark and its `.logo-bracket` / `.logo-text` spans are gone. The 320px row improves to 40 + 12 + 44 + 44×3 + 12×2 = **252px** inside 288px, so the ≤420px block no longer tightens the brand gap. Record: `spec-v3-nav-swatch-and-hamburger.md` §11
- [x] Panel is `color-mix(in srgb, var(--bg-surface) 94%, transparent)` + `backdrop-filter: blur(12px)`, and the §9 glass contrast gate passes in all four palettes.
- [x] `.nav` background is `color-mix(in srgb, var(--bg-surface) 94%, transparent)` (was 85%, `src/App.css:6`), and the §9 bar contrast gate passes in all four palettes.
- [x] Closing on navigation happens in exactly one place; oxlint drops from 20 to 19 finding lines (11 errors / 8 warnings).
@@ -856,6 +859,8 @@ Eleven criteria are proven by the automated checks in §12 and three more (the 2
| Owner follow-up Q16 — Language first: Language → Mode → Theme | DONE 2026-10-17 — `Navigation.tsx:84-111` (language button first, mode toggle second, `<ThemePaletteMenu />` third at `:111`) and `MobileMenu.tsx:71-132` (Language segment `:71-91`, Mode `:93-113`, Theme color `:115-132`); §3.1 anatomy, §3.4, §9's smoke row, §10 (Q15 note + Q16), §11 criteria, `spec-ui-layout.md:103,106,115`, `AGENTS.md` Theming and `spec-v3-theme-palette-switch.md:242,244,466` corrected. Re-verified: `tsc -b` exit 0; oxlint **19** finding lines; hex/`rgba(` in `src/App.css` **0**; inline `fontSize`/`lineHeight`/`color` **0**; throwaway SSR smoke **8/8** — bar order lang-toggle (2425) < theme-toggle (2534) < palette-trigger (2974) < hamburger (3729), sheet segment labels `Language \| Mode \| Theme` with the swatch row last, three `aria-pressed="true"` groups intact, 6 nav links with one `aria-current="page"`; `vite build --outDir dist-verify` green then deleted; script deleted after the run. Markup-only: no CSS rule keys off child order, so the 647px sheet total and the 320px bar arithmetic still hold |
| Defect — the sheet rolled "Home" on every open | DONE 2026-10-17 — owner-reported. Cause: `MobileMenu.tsx` focused the **first sheet link** in `onAnimationComplete`, and `RollingTextLink` maps `onFocus` → its rolling-text animation, so Home's text rolled on every route (and stayed rolled while focused). Fix: `sheetRef` + `tabIndex={-1}` on the panel (`MobileMenu.tsx:22,28,33,39`; file 144 → 145 lines), the link `ref` prop deleted from `RollingTextLink` (126 → 124 lines, no caller left), `.mobile-menu:focus { outline: none }` (`src/App.css:157-163`) so the panel draws no viewport-sized ring. §7 Focus row, the Step 5 listing + its note, Step 6, §8, §11 and `spec-ui-layout.md:116` updated. Verified: throwaway SSR smoke **6/6** — the panel carries `role="dialog" aria-modal="true" tabindex="-1"`, all 6 sheet links carry no `tabindex`, exactly one `aria-current="page"` and it sits on the row matching the route (`/projects`), the appearance order and the three `aria-pressed` groups intact, bar order intact; `tsc -b` exit 0; oxlint **19**; hex gate **0**; `vite build --outDir dist-verify` green then deleted; script deleted after the run. The visible "no roll on open" is the owner's browser check (repo rule §5) |
| 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 — 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 |
---