mirror of
https://github.com/dong-nz/cv.git
synced 2026-11-22 16:10:40 +07:00
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:
1 parent
4387f889f5
commit
c95f7b09d1
10 files changed
+513
-74
No files matched your search
@@ -56,11 +56,55 @@ export function Navigation() {
|
||||
<>
|
||||
<nav className="nav" role="navigation" aria-label="Main navigation">
|
||||
<div className="nav-container">
|
||||
<Link to="/" className="nav-logo">
|
||||
<span className="logo-bracket">{</span>
|
||||
<span className="logo-text">CV</span>
|
||||
<span className="logo-bracket">}</span>
|
||||
</Link>
|
||||
<div className="nav-brand">
|
||||
{/* Trigger first, brand next: the hamburger is the sheet's own control and sits at
|
||||
the bar's left edge, where a left-handed thumb reaches it. The three appearance
|
||||
controls stay in .nav-actions at the right end. */}
|
||||
<button
|
||||
ref={triggerRef}
|
||||
className="mobile-menu-btn"
|
||||
onClick={() => setMobileOpen((prev) => !prev)}
|
||||
aria-label={mobileOpen ? strings.nav.closeMenu[lang] : strings.nav.openMenu[lang]}
|
||||
aria-expanded={mobileOpen}
|
||||
aria-controls="mobile-menu"
|
||||
>
|
||||
<AnimatePresence mode="wait" initial={false}>
|
||||
{mobileOpen ? (
|
||||
<motion.svg
|
||||
key="close"
|
||||
width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"
|
||||
initial={{ opacity: 0, rotate: -90 }}
|
||||
animate={{ opacity: 1, rotate: 0 }}
|
||||
exit={{ opacity: 0, rotate: 90 }}
|
||||
transition={{ duration: 0.18 }}
|
||||
>
|
||||
<path d="M18 6L6 18M6 6l12 12" />
|
||||
</motion.svg>
|
||||
) : (
|
||||
<motion.svg
|
||||
key="menu"
|
||||
width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"
|
||||
initial={{ opacity: 0, rotate: 90 }}
|
||||
animate={{ opacity: 1, rotate: 0 }}
|
||||
exit={{ opacity: 0, rotate: -90 }}
|
||||
transition={{ duration: 0.18 }}
|
||||
>
|
||||
<path d="M3 12h18M3 6h18M3 18h18" />
|
||||
</motion.svg>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
</button>
|
||||
{/* Brand is a home icon: the same 24px stroke language as the hamburger, and the same
|
||||
<Link to="/"> target the {CV} wordmark always had. The accessible name is the
|
||||
translated Home label; the icon itself is decorative. The current-page marker stays
|
||||
on the nav link and the sheet's Home row. */}
|
||||
<Link to="/" className="nav-logo" aria-label={strings.nav.home[lang]}>
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
||||
<path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" />
|
||||
<polyline points="9 22 9 12 15 12 15 22" />
|
||||
</svg>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
<ul className="nav-menu">
|
||||
{navPaths.map((path) => {
|
||||
@@ -109,41 +153,6 @@ export function Navigation() {
|
||||
</button>
|
||||
|
||||
<ThemePaletteMenu />
|
||||
|
||||
<button
|
||||
ref={triggerRef}
|
||||
className="mobile-menu-btn"
|
||||
onClick={() => setMobileOpen((prev) => !prev)}
|
||||
aria-label={mobileOpen ? strings.nav.closeMenu[lang] : strings.nav.openMenu[lang]}
|
||||
aria-expanded={mobileOpen}
|
||||
aria-controls="mobile-menu"
|
||||
>
|
||||
<AnimatePresence mode="wait" initial={false}>
|
||||
{mobileOpen ? (
|
||||
<motion.svg
|
||||
key="close"
|
||||
width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"
|
||||
initial={{ opacity: 0, rotate: -90 }}
|
||||
animate={{ opacity: 1, rotate: 0 }}
|
||||
exit={{ opacity: 0, rotate: 90 }}
|
||||
transition={{ duration: 0.18 }}
|
||||
>
|
||||
<path d="M18 6L6 18M6 6l12 12" />
|
||||
</motion.svg>
|
||||
) : (
|
||||
<motion.svg
|
||||
key="menu"
|
||||
width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"
|
||||
initial={{ opacity: 0, rotate: 90 }}
|
||||
animate={{ opacity: 1, rotate: 0 }}
|
||||
exit={{ opacity: 0, rotate: -90 }}
|
||||
transition={{ duration: 0.18 }}
|
||||
>
|
||||
<path d="M3 12h18M3 6h18M3 18h18" />
|
||||
</motion.svg>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
Reference in new issue
Block a user