Files
cv/docs/design/specs/ui/spec-ui-navigation.md
T
dong.nguyen c95f7b09d1 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.
2026-10-17 22:33:42 +07:00

2.4 KiB
Raw Blame History

UI Spec — Navigation

Overview

Sticky navigation bar xuất hiện ở top mọi trang. Chứa brand home icon (.nav-logo, <Link to="/">), menu links, theme toggle.


Structure

Navigation
├── Container (max-width, centered, padding)
│   ├── Logo (link → /)
│   ├── Menu (desktop)
│   │   ├── Home
│   │   ├── About
│   │   ├── Experience
│   │   ├── Projects
│   │   ├── Engineering
│   │   ├── Blog
│   │   └── Contact
│   ├── ThemeToggle (dark/light/system)
│   └── MobileMenuButton (hamburger)
└── MobileMenu (overlay, slide-in từ phải)
    ├── Menu links (vertical stack)
    └── ThemeToggle

Props

interface NavigationProps {
  currentPage: string;
}

Desktop Behavior

  • Sticky top, z-index cao nhất (trừ modal)
  • Background: surface color, backdrop-blur khi scroll
  • Logo bên trái, menu giữa, theme toggle bên phải
  • Menu links: text color muted, active state accent color, hover underline nhẹ
  • Spacer giữa menu và theme toggle

Mobile Behavior

  • Logo bên trái, hamburger bên phải
  • Menu button: icon 3 lines, toggle thành X khi mở
  • Mobile menu: full-screen overlay, slide-in từ phải
  • Menu links: vertical stack, font-size lớn, padding rộng
  • Click ngoài overlay → đóng menu
  • Click link → đóng menu + navigate
  • Body scroll lock khi menu mở

Responsive Breakpoints

Breakpoint Width Behavior
Mobile < 768px Hamburger menu
Tablet 768–1023px Full menu
Desktop >= 1024px Full menu

Accessibility

  • role="navigation" trên container
  • aria-label="Main navigation"
  • Mobile menu: aria-expanded, aria-controls
  • Focus trap khi menu mở
  • Escape → đóng menu
  • Focus return về hamburger button khi đóng
  • Semantic <nav> element
  • Skip link (first focusable element) → "Skip to content"

State

  • isOpen (mobile menu)
  • currentPage (active link highlighting)
  • scrolled (background blur trigger)

Variants

Variant Context
Default All pages
Scrolled When page scroll Y > 0

Constraints

  • Không hard-code links — derive từ routes
  • Logo clickable → /
  • Theme toggle không trigger re-render toàn bộ app (context-based)