mirror of
https://github.com/dong-nz/cv.git
synced 2026-11-22 16:10:40 +07:00
feat(nav): CV resume glyph at 24px, portal modal, accent color, tight brand gap
- ResumeIcon: split page outline with a visible left-edge dash and stroked CV lettering (owner's 30-grid draft adapted to the 24 grid, spec follow-up 19), rendered at 24px matching the home glyph inside the 44px target - ResumeDialog: portal to document.body — the fixed overlay anchored to the bar's backdrop-filter containing block instead of the viewport; useClickOutside takes an exclusion ref for the portaled panel - .nav-resume-trigger: glyph is --accent at rest/hover/open, follows both theme axes - .nav-brand: gap 12px -> 4px (borderless icons read glyph-to-glyph); the 420px media rule only drops the bordered action gap to 8px - public/cv-icon.svg rewritten as the canonical glyph; AGENTS.md and spec-v3-resume-redesign.md (follow-ups 19-23) updated
This commit is contained in:
1 parent
affca525b4
commit
4d4fd066cc
9 files changed
+69
-22
No files matched your search
+13
-7
@@ -37,11 +37,14 @@
|
||||
|
||||
/* The hamburger and the brand travel together on the left of the bar so the sheet's trigger
|
||||
sits where a left-handed thumb reaches it. Above 1024px the button is display:none, so this
|
||||
group renders as the home icon alone. */
|
||||
group renders as the home icon alone. Its icons carry no borders, so the spacing that reads
|
||||
is measured between glyphs, not boxes: 4px between 44px targets leaves 24px between the 24px
|
||||
glyphs — a tight brand cluster while the hover fills and the 2px-offset focus rings (2+2px)
|
||||
still stay clear of each other. The bordered action controls keep their wider 16px gap. */
|
||||
.nav-brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.nav-logo:hover {
|
||||
@@ -135,9 +138,12 @@
|
||||
|
||||
/* The resume entry keeps the `.nav-control` 44px target and its hover fill, but carries no
|
||||
outline: it sits in the brand group beside the borderless home icon, and a framed box there
|
||||
reads as a second frame next to the home glyph. `:focus-visible` above still rings it. */
|
||||
reads as a second frame next to the home glyph. `:focus-visible` above still rings it. 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 like the other accent signals. */
|
||||
.nav-resume-trigger {
|
||||
border-color: transparent;
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.nav-resume-trigger:hover,
|
||||
@@ -332,21 +338,21 @@
|
||||
}
|
||||
|
||||
/* Six controls share the bar at ≤1024px: hamburger, home, resume, then the three appearance
|
||||
controls. At 390px the old gaps leave the row flush (260px of controls + 48px of gaps inside
|
||||
358px of content), so the brand and action gaps both drop to 8px here: 292px used, 66px slack. */
|
||||
controls. The brand group keeps its 4px at every width; only the bordered action controls
|
||||
drop from 16px to 8px here: 260px of controls + 8px of brand gaps + 16px of action gaps =
|
||||
284px used inside 358px of content at 390px. */
|
||||
@media (max-width: 420px) {
|
||||
.nav-container {
|
||||
padding: 0 16px;
|
||||
}
|
||||
|
||||
.nav-brand,
|
||||
.nav-actions {
|
||||
gap: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 320px keeps every 44px target intact and pays for them out of the gutter instead: 12px padding
|
||||
leaves 296px of content for 260px of controls + 32px of gaps — 4px of slack. */
|
||||
leaves 296px of content for 260px of controls + 24px of gaps — 12px of slack. */
|
||||
@media (max-width: 360px) {
|
||||
.nav-container {
|
||||
padding: 0 12px;
|
||||
|
||||
@@ -28,7 +28,7 @@ export function ResumeNavButton() {
|
||||
title={strings.common.resumeModalHint[lang]}
|
||||
onClick={openDialog}
|
||||
>
|
||||
<ResumeIcon />
|
||||
<ResumeIcon size={24} />
|
||||
</button>
|
||||
|
||||
<ResumeDialog open={open} close={close} panelRef={panelRef} dialogId="resume-modal-nav" />
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { AnimatePresence, motion } from 'motion/react'
|
||||
import { useEffect } from 'react'
|
||||
import { createPortal } from 'react-dom'
|
||||
import { resumeUrlFor, resumeLanguages, resumeLanguageLabels } from '@/data/resume'
|
||||
import { useLanguage } from '@/hooks/useLanguage'
|
||||
import { strings } from '@/i18n/strings'
|
||||
@@ -13,7 +14,9 @@ type ResumeDialogProps = {
|
||||
|
||||
/**
|
||||
* The language picker. Mounted by every trigger with its own `dialogId` so `aria-controls` never
|
||||
* points at a duplicated id when two triggers are on the same page.
|
||||
* points at a duplicated id when two triggers are on the same page. The overlay portals to
|
||||
* `document.body`: the nav bar's `backdrop-filter` makes `.nav` a containing block for fixed
|
||||
* descendants, which would size the viewport overlay to the bar and clip the panel.
|
||||
*/
|
||||
export function ResumeDialog({ open, close, panelRef, dialogId }: ResumeDialogProps) {
|
||||
const { lang } = useLanguage()
|
||||
@@ -27,7 +30,7 @@ export function ResumeDialog({ open, close, panelRef, dialogId }: ResumeDialogPr
|
||||
return () => cancelAnimationFrame(frame)
|
||||
}, [open, panelRef])
|
||||
|
||||
return (
|
||||
return createPortal(
|
||||
<AnimatePresence>
|
||||
{open && (
|
||||
<motion.div
|
||||
@@ -83,6 +86,7 @@ export function ResumeDialog({ open, close, panelRef, dialogId }: ResumeDialogPr
|
||||
</motion.div>
|
||||
</motion.div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
</AnimatePresence>,
|
||||
document.body,
|
||||
)
|
||||
}
|
||||
@@ -44,14 +44,22 @@ export function TelegramIcon({ size = 20 }: IconProps) {
|
||||
)
|
||||
}
|
||||
|
||||
// CV lettering, same 2px stroke language as the bar's other glyphs: a C arc open to the right and
|
||||
// a V, sized to fill the 24 grid. A document outline with small lettering inside was rasterized
|
||||
// first and merged into mush at the bar's 20px, so the letters carry the meaning alone.
|
||||
// Resume document glyph — the canonical shape lives in public/cv-icon.svg; keep the two in step.
|
||||
// The owner's CV artwork (a 30-grid draft, spec follow-up 19) adapted to the bar's 24 grid: a
|
||||
// page outline split on the left edge by a visible dash (4px endpoint gaps stay open under 2px
|
||||
// round caps), a folded
|
||||
// corner, and stroked CV lettering replacing the content lines — the only arrangement that
|
||||
// keeps the lettering readable at the bar's size, because the page is otherwise empty.
|
||||
// The translated aria-label on the trigger carries the action; the glyph stays aria-hidden.
|
||||
export function ResumeIcon({ size = 20 }: IconProps) {
|
||||
return (
|
||||
<svg viewBox="0 0 24 24" width={size} height={size} aria-hidden="true" {...strokeProps}>
|
||||
<path d="M13.5 7.8A6.5 6.5 0 1 0 13.5 16.2" />
|
||||
<path d="M15 6l3.5 12L22 6" />
|
||||
<path d="M14 2 H6 a2 2 0 0 0 -2 2 V6" />
|
||||
<path d="M4 10 V12" />
|
||||
<path d="M4 16 v4 a2 2 0 0 0 2 2 h12 a2 2 0 0 0 2 -2 V8 L14 2" />
|
||||
<path d="M14 2 v4 a2 2 0 0 0 2 2 h4" />
|
||||
<path d="M9.5 12 A3 3 0 0 0 9.5 18" />
|
||||
<path d="M12.5 12 L15 18 L17.5 12" />
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
@@ -1,10 +1,14 @@
|
||||
import { useEffect } from 'react'
|
||||
|
||||
export function useClickOutside(ref: React.RefObject<HTMLElement | null>, handler: () => void) {
|
||||
export function useClickOutside(
|
||||
ref: React.RefObject<HTMLElement | null>,
|
||||
handler: () => void,
|
||||
extraRef?: React.RefObject<HTMLElement | null>,
|
||||
) {
|
||||
useEffect(() => {
|
||||
const listener = (event: MouseEvent | TouchEvent) => {
|
||||
const el = ref.current
|
||||
if (!el || el.contains(event.target as Node)) return
|
||||
const target = event.target as Node
|
||||
if (ref.current?.contains(target) || extraRef?.current?.contains(target)) return
|
||||
handler()
|
||||
}
|
||||
document.addEventListener('mousedown', listener)
|
||||
@@ -13,5 +17,5 @@ export function useClickOutside(ref: React.RefObject<HTMLElement | null>, handle
|
||||
document.removeEventListener('mousedown', listener)
|
||||
document.removeEventListener('touchstart', listener)
|
||||
}
|
||||
}, [ref, handler])
|
||||
}, [ref, handler, extraRef])
|
||||
}
|
||||
@@ -28,7 +28,10 @@ export function useResumeDialog() {
|
||||
|
||||
const openDialog = useCallback(() => setOpen(true), [])
|
||||
|
||||
useClickOutside(containerRef, close)
|
||||
// The dialog panels portal themselves to document.body (the nav bar's backdrop-filter would
|
||||
// otherwise clip their fixed overlay to the bar), so the panel is no longer inside
|
||||
// containerRef — it is passed as the second watched ref so clicks in it are not "outside".
|
||||
useClickOutside(containerRef, close, panelRef)
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return
|
||||
|
||||
Reference in new issue
Block a user