mirror of
https://github.com/dong-nz/cv.git
synced 2026-11-22 16:10:40 +07:00
feat(nav): mobile sheet + shared bar control chrome (v3 mobile navigation)
MobileMenu.tsx: conditional-mounted glass sheet (94% + blur(12px)), three labelled groups, staggered rows, Mode/Language/Theme-color segmented rows, Connect tiles, safe-area padding, overscroll contain. Navigation.tsx: honest dialog - Escape on document, inert on #main-content/.footer/.back-to-top, focus restore guarded by offsetParent, matchMedia close above 1024px, icon morph, navPaths from data; route-change close effect deleted. SocialLinks: single data-driven renderer (src/data/social.ts + strings.social.aria); Hero and Footer cut over; mailto without target/rel; dead .social-link span rule removed; hero/footer centering scoped. Bar: .nav-control shared chrome for mode/language/theme-color, icon-only 20px half-circle palette trigger at every width, <=420px bar guard; .nav glass 85% -> 94%. Docs: spec-v3-mobile-navigation.md v0.5.0 (Q14 recorded, gates re-run 16/16 SSR), spec-ui-layout.md and AGENTS.md corrected.
This commit is contained in:
1 parent
f2c920d6ad
commit
d0aa9958c8
16 files changed
+1386
-311
No files matched your search
+177
-116
@@ -1,9 +1,12 @@
|
||||
/* ===== Navigation ===== */
|
||||
/* 94% + blur(12px) is a contrast floor, not a taste choice: at 85% the bar measured 4.01
|
||||
(red-light --text-muted over an --accent element scrolled beneath it); 94% measures 4.58.
|
||||
Spec: docs/design/specs/v3/spec-v3-mobile-navigation.md §3.2 */
|
||||
.nav {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1000;
|
||||
background: color-mix(in srgb, var(--bg-surface) 85%, transparent);
|
||||
background: color-mix(in srgb, var(--bg-surface) 94%, transparent);
|
||||
border-bottom: 1px solid var(--border);
|
||||
backdrop-filter: blur(12px);
|
||||
transition: none;
|
||||
@@ -83,29 +86,42 @@
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.theme-toggle {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-muted);
|
||||
cursor: pointer;
|
||||
padding: 8px;
|
||||
border-radius: var(--radius-md);
|
||||
transition: color var(--transition-fast), background var(--transition-fast);
|
||||
/* One chrome for the three bar controls — mode, theme color, language: a bordered 44px box,
|
||||
accent border + text on hover/open. Per-control rules add only what is specific to them. */
|
||||
.nav-control {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 44px;
|
||||
min-height: 44px;
|
||||
padding: 8px;
|
||||
background: transparent;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-md);
|
||||
color: var(--text-primary);
|
||||
cursor: pointer;
|
||||
transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
|
||||
}
|
||||
|
||||
.theme-toggle:hover {
|
||||
color: var(--text-primary);
|
||||
.nav-control:hover,
|
||||
.nav-control.open {
|
||||
border-color: var(--accent);
|
||||
color: var(--accent);
|
||||
background: var(--bg-elevated);
|
||||
}
|
||||
|
||||
.theme-toggle:focus-visible {
|
||||
.nav-control:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* The language control's glyph is chrome: 13px/600 is its own scale step. */
|
||||
.lang-toggle {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.mobile-menu-btn {
|
||||
display: none;
|
||||
background: none;
|
||||
@@ -121,58 +137,159 @@
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* Mobile menu */
|
||||
/* Mobile menu sheet — mounted only while open, and only at <=1024px (guard below).
|
||||
94% + blur(12px) is a contrast floor, not taste: the worst measured case is --text-muted
|
||||
over an --accent tile behind the glass — 4.58 at 94%, 4.45 at 92% (fails AA), 4.01 at the
|
||||
bar's old 85%. --text-muted is what .mobile-menu-heading and the palette trigger render. */
|
||||
.mobile-menu {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 64px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: var(--bg-surface);
|
||||
z-index: 999;
|
||||
padding: 32px 24px;
|
||||
background: color-mix(in srgb, var(--bg-surface) 94%, transparent);
|
||||
backdrop-filter: blur(12px);
|
||||
padding: 24px 24px calc(24px + env(safe-area-inset-bottom));
|
||||
overflow-y: auto;
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
|
||||
.mobile-menu.open {
|
||||
.mobile-menu-inner {
|
||||
max-width: var(--max-content);
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.mobile-menu-group {
|
||||
padding-bottom: 12px;
|
||||
margin-bottom: 12px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
/* 12px + one hairline per group is what holds the sheet at 647px closed; 24px would reach
|
||||
667px and push the Connect group past a 375x667 phone (spec §3.3). */
|
||||
.mobile-menu-group:last-child {
|
||||
border-bottom: none;
|
||||
padding-bottom: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.mobile-menu-heading {
|
||||
display: block;
|
||||
animation: slideIn var(--transition-normal) ease;
|
||||
}
|
||||
|
||||
@keyframes slideIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateX(20px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateX(0);
|
||||
}
|
||||
font-family: var(--mono);
|
||||
font-size: var(--text-meta);
|
||||
line-height: 1;
|
||||
letter-spacing: 1.5px;
|
||||
text-transform: uppercase;
|
||||
color: var(--text-muted);
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.mobile-menu-list {
|
||||
list-style: none;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.mobile-menu-link {
|
||||
display: block;
|
||||
font-size: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: 48px;
|
||||
padding: 0 12px 0 10px;
|
||||
border-left: 2px solid transparent;
|
||||
font-size: var(--text-lede);
|
||||
font-weight: 500;
|
||||
color: var(--text-secondary);
|
||||
padding: 12px 0;
|
||||
text-decoration: none;
|
||||
transition: color var(--transition-fast);
|
||||
transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
|
||||
}
|
||||
|
||||
.mobile-menu-link:hover,
|
||||
.mobile-menu-link:active {
|
||||
background: var(--bg-elevated);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.mobile-menu-link.active {
|
||||
border-left-color: var(--accent);
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.mobile-menu-link:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: -2px;
|
||||
}
|
||||
|
||||
.mobile-menu-segment {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
min-height: 48px;
|
||||
}
|
||||
|
||||
.mobile-menu-segment-label {
|
||||
font-size: var(--text-body);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.mobile-menu-segment-options {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.mobile-menu-segment-option {
|
||||
min-height: 44px;
|
||||
padding: 8px 16px;
|
||||
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;
|
||||
}
|
||||
|
||||
/* The palette options use the Mode/Language segmented row's shape — same 44px target, border
|
||||
and radius — drawn as colour icons via the existing .nav-palette-preview dot. */
|
||||
.mobile-menu-swatch-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 44px;
|
||||
min-height: 44px;
|
||||
padding: 0;
|
||||
border: 1px solid var(--border-strong);
|
||||
border-radius: var(--radius-md);
|
||||
background: none;
|
||||
cursor: pointer;
|
||||
transition: background var(--transition-fast), border-color var(--transition-fast);
|
||||
}
|
||||
|
||||
.mobile-menu-swatch-option:hover {
|
||||
background: var(--bg-elevated);
|
||||
}
|
||||
|
||||
.mobile-menu-swatch-option.active {
|
||||
border-color: var(--accent);
|
||||
background: var(--bg-elevated);
|
||||
}
|
||||
|
||||
.mobile-menu-swatch-option:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
.nav-menu {
|
||||
display: none;
|
||||
@@ -181,8 +298,22 @@
|
||||
.mobile-menu-btn {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
.nav-palette-nav {
|
||||
/* Four controls share the bar at ≤1024px. At 320px: {CV} (~70px) + 44×4 controls + 12×3 gaps
|
||||
= 262px inside 288px of content, so the row keeps 26px of slack. */
|
||||
@media (max-width: 420px) {
|
||||
.nav-container {
|
||||
padding: 0 16px;
|
||||
}
|
||||
|
||||
.nav-actions {
|
||||
gap: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1025px) {
|
||||
.mobile-menu {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -193,51 +324,19 @@
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.nav-palette-trigger {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-muted);
|
||||
cursor: pointer;
|
||||
padding: 8px;
|
||||
border-radius: var(--radius-md);
|
||||
font-size: 14px;
|
||||
transition: color var(--transition-fast), background var(--transition-fast);
|
||||
}
|
||||
|
||||
.nav-palette-trigger:hover,
|
||||
.nav-palette-trigger.open {
|
||||
color: var(--text-primary);
|
||||
background: var(--bg-elevated);
|
||||
}
|
||||
|
||||
.nav-palette-trigger:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
/* Nothing specific to declare: the trigger's chrome is `.nav-control` above, it holds a single
|
||||
icon, and its accessible name lives in `aria-label`. The class stays as the hook that ties
|
||||
the trigger to the `#palette-menu` panel it expands. */
|
||||
|
||||
/* The palette icon: left half is the active palette's accent, right half the constant empty
|
||||
half (--swatch-empty). The hairline keeps the white half visible on a light surface. */
|
||||
.nav-palette-swatch {
|
||||
flex: none;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
background: var(--accent);
|
||||
box-shadow: inset 0 0 0 1px var(--border-strong);
|
||||
}
|
||||
|
||||
/* The group name is redundant in the bar (the trigger is labelled) but needed in the sheet. */
|
||||
.nav-palette-group {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.nav-palette-trigger .chevron {
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
|
||||
.nav-palette-trigger.open .chevron {
|
||||
transform: rotate(180deg);
|
||||
border: 1px solid var(--border-strong);
|
||||
background: linear-gradient(to right, var(--accent) 0 50%, var(--swatch-empty) 50% 100%);
|
||||
}
|
||||
|
||||
.nav-palette-panel {
|
||||
@@ -331,41 +430,6 @@
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
/* Sheet variant: the options expand inline inside the mobile menu, never as a
|
||||
second overlay. .mobile-menu is display:none unless .open, so this block is
|
||||
already unreachable above 1024px. */
|
||||
.nav-palette-sheet {
|
||||
display: block;
|
||||
margin-top: 16px;
|
||||
padding-top: 16px;
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.nav-palette-sheet .nav-palette-trigger {
|
||||
width: 100%;
|
||||
min-height: 44px;
|
||||
padding: 12px 0;
|
||||
font-size: var(--text-body);
|
||||
}
|
||||
|
||||
.nav-palette-sheet .nav-palette-group {
|
||||
display: inline;
|
||||
font-size: var(--text-meta);
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.nav-palette-sheet .nav-palette-panel {
|
||||
position: static;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
padding: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.nav-palette-sheet .nav-palette-option {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
/* ===== Buttons ===== */
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
@@ -554,10 +618,6 @@
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
.social-link span {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
/* ===== Section Background Gradient ===== */
|
||||
.section {
|
||||
@@ -820,7 +880,8 @@
|
||||
color: var(--text-primary) !important;
|
||||
opacity: 1 !important;
|
||||
}
|
||||
.social-links {
|
||||
.hero .social-links,
|
||||
.footer .social-links {
|
||||
justify-content: center;
|
||||
}
|
||||
.social-link {
|
||||
|
||||
@@ -2,7 +2,8 @@ import { Link } from 'react-router'
|
||||
import { profile } from '@/data/profile'
|
||||
import { useLanguage } from '@/hooks/useLanguage'
|
||||
import { strings } from '@/i18n/strings'
|
||||
const footerPaths = ['/', '/about', '/projects', '/contact'] as const
|
||||
import { footerPaths } from '@/data/navigation'
|
||||
import { SocialLinks } from '@/components/ui/SocialLinks'
|
||||
|
||||
export function Footer() {
|
||||
const year = new Date().getFullYear()
|
||||
@@ -29,40 +30,7 @@ export function Footer() {
|
||||
})}
|
||||
</ul>
|
||||
|
||||
<div className="social-links">
|
||||
<a
|
||||
href={profile.githubUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="social-link"
|
||||
aria-label="GitHub"
|
||||
>
|
||||
<svg viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z" />
|
||||
</svg>
|
||||
</a>
|
||||
<a
|
||||
href={profile.linkedinUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="social-link"
|
||||
aria-label="LinkedIn"
|
||||
>
|
||||
<svg viewBox="0 0 24 24" fill="currentColor">
|
||||
<path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z" />
|
||||
</svg>
|
||||
</a>
|
||||
<a
|
||||
href={`mailto:${profile.email}`}
|
||||
className="social-link"
|
||||
aria-label="Email"
|
||||
>
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||
<rect x="2" y="4" width="20" height="16" rx="2" />
|
||||
<path d="M22 4l-10 8L2 4" />
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
<SocialLinks />
|
||||
</div>
|
||||
</footer>
|
||||
)
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
import { useRef } from 'react'
|
||||
import { useLocation } from 'react-router'
|
||||
import { AnimatePresence, motion, useReducedMotion } from 'motion/react'
|
||||
import { navPaths } from '@/data/navigation'
|
||||
import { paletteIds, paletteMeta } from '@/data/palettes'
|
||||
import { useTheme } from '@/hooks/useTheme'
|
||||
import { useLanguage } from '@/hooks/useLanguage'
|
||||
import { strings } from '@/i18n/strings'
|
||||
import { RollingTextLink } from '@/components/ui/RollingTextLink'
|
||||
import { SocialLinks } from '@/components/ui/SocialLinks'
|
||||
|
||||
interface MobileMenuProps {
|
||||
open: boolean
|
||||
onClose: () => void
|
||||
}
|
||||
|
||||
export function MobileMenu({ open, onClose }: MobileMenuProps) {
|
||||
const { lang, setLang } = useLanguage()
|
||||
const { resolvedTheme, setTheme, palette, setPalette } = useTheme()
|
||||
const location = useLocation()
|
||||
const reduceMotion = useReducedMotion()
|
||||
const firstLinkRef = useRef<HTMLAnchorElement>(null)
|
||||
|
||||
return (
|
||||
<AnimatePresence>
|
||||
{open && (
|
||||
<motion.div
|
||||
id="mobile-menu"
|
||||
className="mobile-menu"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label={strings.nav.menuAria[lang]}
|
||||
initial={{ opacity: 0, y: -12 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
exit={{ opacity: 0, y: -12 }}
|
||||
transition={{ duration: 0.22, ease: [0.25, 0.1, 0.25, 1] }}
|
||||
onAnimationComplete={() => firstLinkRef.current?.focus()}
|
||||
>
|
||||
<div className="mobile-menu-inner">
|
||||
<nav className="mobile-menu-group" aria-label={strings.nav.groupMenu[lang]}>
|
||||
<span className="mobile-menu-heading">{strings.nav.groupMenu[lang]}</span>
|
||||
<ul className="mobile-menu-list">
|
||||
{navPaths.map((path, index) => {
|
||||
const navKey = path === '/' ? 'home' : path.replace('/', '') as keyof typeof strings.nav
|
||||
const active = path === location.pathname
|
||||
return (
|
||||
<motion.li
|
||||
key={path}
|
||||
initial={{ opacity: 0, y: 8 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
transition={{ duration: 0.22, delay: reduceMotion ? 0 : 0.05 + index * 0.04 }}
|
||||
>
|
||||
<RollingTextLink
|
||||
to={path}
|
||||
ref={index === 0 ? firstLinkRef : undefined}
|
||||
ariaCurrent={active ? 'page' : undefined}
|
||||
className={active ? 'mobile-menu-link active' : 'mobile-menu-link'}
|
||||
onClick={onClose}
|
||||
>
|
||||
{strings.nav[navKey][lang]}
|
||||
</RollingTextLink>
|
||||
</motion.li>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div className="mobile-menu-group">
|
||||
<span className="mobile-menu-heading">{strings.nav.groupAppearance[lang]}</span>
|
||||
|
||||
<div className="mobile-menu-segment">
|
||||
<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]}>
|
||||
<button
|
||||
type="button"
|
||||
className={resolvedTheme === 'dark' ? 'mobile-menu-segment-option active' : 'mobile-menu-segment-option'}
|
||||
aria-pressed={resolvedTheme === 'dark'}
|
||||
onClick={() => setTheme('dark')}
|
||||
>
|
||||
{strings.nav.themeDark[lang]}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className={resolvedTheme === 'light' ? 'mobile-menu-segment-option active' : 'mobile-menu-segment-option'}
|
||||
aria-pressed={resolvedTheme === 'light'}
|
||||
onClick={() => setTheme('light')}
|
||||
>
|
||||
{strings.nav.themeLight[lang]}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mobile-menu-segment">
|
||||
<span className="mobile-menu-segment-label">{strings.nav.langGroup[lang]}</span>
|
||||
<div className="mobile-menu-segment-options" role="group" aria-label={strings.nav.langGroup[lang]}>
|
||||
<button
|
||||
type="button"
|
||||
className={lang === 'en' ? 'mobile-menu-segment-option active' : 'mobile-menu-segment-option'}
|
||||
aria-pressed={lang === 'en'}
|
||||
onClick={() => setLang('en')}
|
||||
>
|
||||
{strings.nav.langEn[lang]}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className={lang === 'vi' ? 'mobile-menu-segment-option active' : 'mobile-menu-segment-option'}
|
||||
aria-pressed={lang === 'vi'}
|
||||
onClick={() => setLang('vi')}
|
||||
>
|
||||
{strings.nav.langVi[lang]}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mobile-menu-segment">
|
||||
<span className="mobile-menu-segment-label">{strings.nav.palette[lang]}</span>
|
||||
<div className="mobile-menu-segment-options" role="group" aria-label={strings.nav.palette[lang]}>
|
||||
{paletteIds.map((id) => (
|
||||
<button
|
||||
key={id}
|
||||
type="button"
|
||||
className={palette === id ? 'mobile-menu-swatch-option active' : 'mobile-menu-swatch-option'}
|
||||
aria-pressed={palette === id}
|
||||
aria-label={paletteMeta[id].label[lang]}
|
||||
title={paletteMeta[id].hint[lang]}
|
||||
onClick={() => setPalette(id)}
|
||||
>
|
||||
<span className="nav-palette-preview" data-preview={id} aria-hidden="true" />
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mobile-menu-group">
|
||||
<span className="mobile-menu-heading">{strings.social.heading[lang]}</span>
|
||||
<SocialLinks />
|
||||
</div>
|
||||
</div>
|
||||
</motion.div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
)
|
||||
}
|
||||
@@ -1,31 +1,56 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import { Link, useLocation } from 'react-router'
|
||||
import { AnimatePresence, motion } from 'motion/react'
|
||||
import { useTheme } from '@/hooks/useTheme'
|
||||
import { useLanguage } from '@/hooks/useLanguage'
|
||||
import { strings } from '@/i18n/strings'
|
||||
import { navPaths } from '@/data/navigation'
|
||||
import { RollingTextLink } from '@/components/ui/RollingTextLink'
|
||||
import { ThemePaletteMenu } from '@/components/layout/ThemePaletteMenu'
|
||||
const navPaths = ['/', '/about', '/experience', '/projects', '/contact', '/philosophy'] as const
|
||||
import { MobileMenu } from '@/components/layout/MobileMenu'
|
||||
|
||||
export function Navigation() {
|
||||
const { cycleTheme, resolvedTheme } = useTheme()
|
||||
const { lang, toggleLang } = useLanguage()
|
||||
const [mobileOpen, setMobileOpen] = useState(false)
|
||||
const location = useLocation()
|
||||
const triggerRef = useRef<HTMLButtonElement>(null)
|
||||
|
||||
const closeMenu = useCallback(() => {
|
||||
setMobileOpen(false)
|
||||
// The hamburger is display:none above 1024px — focusing it there would drop focus to <body>.
|
||||
if (triggerRef.current?.offsetParent) triggerRef.current.focus()
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (mobileOpen) {
|
||||
document.body.style.overflow = 'hidden'
|
||||
} else {
|
||||
document.body.style.overflow = ''
|
||||
if (!mobileOpen) return
|
||||
document.body.style.overflow = 'hidden'
|
||||
const covered = [
|
||||
document.getElementById('main-content'),
|
||||
document.querySelector('.footer'),
|
||||
document.querySelector('.back-to-top'),
|
||||
]
|
||||
covered.forEach((el) => el?.setAttribute('inert', ''))
|
||||
const handleKey = (event: KeyboardEvent) => {
|
||||
if (event.key === 'Escape') closeMenu()
|
||||
}
|
||||
document.addEventListener('keydown', handleKey)
|
||||
return () => {
|
||||
document.body.style.overflow = ''
|
||||
covered.forEach((el) => el?.removeAttribute('inert'))
|
||||
document.removeEventListener('keydown', handleKey)
|
||||
}
|
||||
}, [mobileOpen])
|
||||
}, [mobileOpen, closeMenu])
|
||||
|
||||
// The sheet only exists at <=1024px; crossing upward must close it so aria-expanded stays honest.
|
||||
useEffect(() => {
|
||||
setMobileOpen(false)
|
||||
}, [location.pathname])
|
||||
const mobile = window.matchMedia('(max-width: 1024px)')
|
||||
const handleChange = (event: MediaQueryListEvent) => {
|
||||
if (!event.matches) setMobileOpen(false)
|
||||
}
|
||||
mobile.addEventListener('change', handleChange)
|
||||
return () => mobile.removeEventListener('change', handleChange)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -45,6 +70,7 @@ export function Navigation() {
|
||||
<li key={path}>
|
||||
<RollingTextLink
|
||||
to={path}
|
||||
ariaCurrent={path === location.pathname ? 'page' : undefined}
|
||||
className={path === location.pathname ? 'nav-link active' : 'nav-link'}
|
||||
>
|
||||
{label}
|
||||
@@ -56,7 +82,7 @@ export function Navigation() {
|
||||
|
||||
<div className="nav-actions">
|
||||
<button
|
||||
className="theme-toggle"
|
||||
className="nav-control theme-toggle"
|
||||
onClick={cycleTheme}
|
||||
aria-label={`Switch theme (currently ${resolvedTheme})`}
|
||||
title={`Theme: ${resolvedTheme}`}
|
||||
@@ -73,57 +99,56 @@ export function Navigation() {
|
||||
)}
|
||||
</button>
|
||||
|
||||
<ThemePaletteMenu variant="nav" />
|
||||
|
||||
<button
|
||||
className="lang-toggle"
|
||||
className="nav-control lang-toggle"
|
||||
onClick={toggleLang}
|
||||
aria-label="Switch language"
|
||||
title={`Switch to ${lang === 'en' ? 'Tiếng Việt' : 'English'}`}
|
||||
>
|
||||
{lang === 'en' ? 'VI' : 'EN'}
|
||||
</button>
|
||||
|
||||
<ThemePaletteMenu />
|
||||
|
||||
<button
|
||||
ref={triggerRef}
|
||||
className="mobile-menu-btn"
|
||||
onClick={() => setMobileOpen(!mobileOpen)}
|
||||
aria-label={mobileOpen ? 'Close menu' : 'Open menu'}
|
||||
onClick={() => setMobileOpen((prev) => !prev)}
|
||||
aria-label={mobileOpen ? strings.nav.closeMenu[lang] : strings.nav.openMenu[lang]}
|
||||
aria-expanded={mobileOpen}
|
||||
aria-controls="mobile-menu"
|
||||
>
|
||||
{mobileOpen ? (
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||
<path d="M18 6L6 18M6 6l12 12" />
|
||||
</svg>
|
||||
) : (
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
|
||||
<path d="M3 12h18M3 6h18M3 18h18" />
|
||||
</svg>
|
||||
)}
|
||||
<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>
|
||||
|
||||
<div className={`mobile-menu ${mobileOpen ? 'open' : ''}`} role="dialog" aria-label="Mobile navigation">
|
||||
<ul className="mobile-menu-list">
|
||||
{navPaths.map((path) => {
|
||||
const navKey = path === '/' ? 'home' : path.replace('/', '') as keyof typeof strings.nav
|
||||
const label = strings.nav[navKey][lang]
|
||||
return (
|
||||
<li key={path}>
|
||||
<RollingTextLink
|
||||
to={path}
|
||||
className={path === location.pathname ? 'mobile-menu-link active' : 'mobile-menu-link'}
|
||||
onClick={() => setMobileOpen(false)}
|
||||
>
|
||||
{label}
|
||||
</RollingTextLink>
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
|
||||
<ThemePaletteMenu key={location.pathname} variant="sheet" />
|
||||
</div>
|
||||
<MobileMenu open={mobileOpen} onClose={closeMenu} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -5,11 +5,7 @@ import { useClickOutside } from '@/hooks/useClickOutside'
|
||||
import { paletteIds, paletteMeta } from '@/data/palettes'
|
||||
import { strings } from '@/i18n/strings'
|
||||
|
||||
interface ThemePaletteMenuProps {
|
||||
variant: 'nav' | 'sheet'
|
||||
}
|
||||
|
||||
export function ThemePaletteMenu({ variant }: ThemePaletteMenuProps) {
|
||||
export function ThemePaletteMenu() {
|
||||
const { palette, setPalette } = useTheme()
|
||||
const { lang } = useLanguage()
|
||||
const [open, setOpen] = useState(false)
|
||||
@@ -20,43 +16,30 @@ export function ThemePaletteMenu({ variant }: ThemePaletteMenuProps) {
|
||||
useClickOutside(containerRef, close)
|
||||
|
||||
const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
|
||||
if (event.key !== 'Escape') return
|
||||
// Only while the submenu is open: React's synthetic stopPropagation() stops the native
|
||||
// event too, so an unconditional call would also swallow a host's own Escape handling.
|
||||
if (event.key !== 'Escape' || !open) return
|
||||
event.stopPropagation()
|
||||
close()
|
||||
triggerRef.current?.focus()
|
||||
}
|
||||
|
||||
return (
|
||||
<div ref={containerRef} className={`nav-palette nav-palette-${variant}`} onKeyDown={handleKeyDown}>
|
||||
<div ref={containerRef} className="nav-palette" onKeyDown={handleKeyDown}>
|
||||
<button
|
||||
ref={triggerRef}
|
||||
type="button"
|
||||
className={`nav-palette-trigger ${open ? 'open' : ''}`}
|
||||
className={`nav-control nav-palette-trigger ${open ? 'open' : ''}`}
|
||||
aria-expanded={open}
|
||||
aria-controls={`palette-menu-${variant}`}
|
||||
aria-controls="palette-menu"
|
||||
aria-label={`${strings.nav.palette[lang]}: ${paletteMeta[palette].label[lang]}`}
|
||||
title={strings.nav.paletteAria[lang]}
|
||||
onClick={() => setOpen((prev) => !prev)}
|
||||
>
|
||||
<span className="nav-palette-swatch" aria-hidden="true" />
|
||||
<span className="nav-palette-group">{strings.nav.palette[lang]}</span>
|
||||
<span className="nav-palette-current">{paletteMeta[palette].label[lang]}</span>
|
||||
<svg
|
||||
className="chevron"
|
||||
width="16"
|
||||
height="16"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<polyline points="6 9 12 15 18 9" />
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<div id={`palette-menu-${variant}`} className={`nav-palette-panel ${open ? 'open' : ''}`}>
|
||||
<div id="palette-menu" className={`nav-palette-panel ${open ? 'open' : ''}`}>
|
||||
{paletteIds.map((id) => (
|
||||
<button
|
||||
key={id}
|
||||
|
||||
@@ -28,41 +28,6 @@ function HeroDownloadButton({lang}: { lang: Language }) {
|
||||
)
|
||||
}
|
||||
|
||||
const socialLinks = [
|
||||
{
|
||||
label: "GitHub",
|
||||
href: profile.githubUrl,
|
||||
"aria-label": "View GitHub profile",
|
||||
icon: (
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" width="20" height="20">
|
||||
<path
|
||||
d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z"/>
|
||||
</svg>
|
||||
),
|
||||
},
|
||||
{
|
||||
label: "LinkedIn",
|
||||
href: profile.linkedinUrl,
|
||||
"aria-label": "View LinkedIn profile",
|
||||
icon: (
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" width="20" height="20">
|
||||
<path
|
||||
d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"/>
|
||||
</svg>
|
||||
),
|
||||
},
|
||||
{
|
||||
label: "Email",
|
||||
href: `mailto:${profile.email}`,
|
||||
"aria-label": "Send email",
|
||||
icon: (
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" width="20" height="20">
|
||||
<rect x="2" y="4" width="20" height="16" rx="2"/>
|
||||
<path d="M22 4l-10 8L2 4"/>
|
||||
</svg>
|
||||
),
|
||||
},
|
||||
]
|
||||
|
||||
export function Hero() {
|
||||
const {scrollY} = useScroll()
|
||||
@@ -145,7 +110,7 @@ export function Hero() {
|
||||
</>
|
||||
)}
|
||||
|
||||
<SocialLinks links={socialLinks}/>
|
||||
<SocialLinks />
|
||||
</motion.div>
|
||||
</motion.div>
|
||||
<div className="scroll-indicator" aria-hidden="true">
|
||||
|
||||
@@ -21,10 +21,12 @@ interface RollingTextLinkProps {
|
||||
to: string
|
||||
className?: string
|
||||
onClick?: () => void
|
||||
ariaCurrent?: 'page'
|
||||
ref?: React.Ref<HTMLAnchorElement>
|
||||
children: React.ReactNode
|
||||
}
|
||||
|
||||
export function RollingTextLink({ to, className, onClick, children }: RollingTextLinkProps) {
|
||||
export function RollingTextLink({ to, className, onClick, ariaCurrent, ref, children }: RollingTextLinkProps) {
|
||||
const reduceMotion = useReducedMotion()
|
||||
const [active, setActive] = useState(false)
|
||||
const activeRef = useRef(false)
|
||||
@@ -71,9 +73,11 @@ export function RollingTextLink({ to, className, onClick, children }: RollingTex
|
||||
|
||||
return (
|
||||
<Link
|
||||
ref={ref}
|
||||
to={to}
|
||||
className={className}
|
||||
onClick={onClick}
|
||||
aria-current={ariaCurrent}
|
||||
onPointerEnter={() => {
|
||||
hovered.current = true
|
||||
requestActive(true)
|
||||
|
||||
@@ -1,32 +1,49 @@
|
||||
import { motion } from "motion/react"
|
||||
import { socialLinks } from "@/data/social"
|
||||
import { useLanguage } from "@/hooks/useLanguage"
|
||||
import { strings } from "@/i18n/strings"
|
||||
import type { SocialId } from "@/types"
|
||||
|
||||
interface SocialLink {
|
||||
label: string
|
||||
href: string
|
||||
icon: React.ReactNode
|
||||
"aria-label": string
|
||||
const icons: Record<SocialId, React.ReactNode> = {
|
||||
github: (
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" width="20" height="20">
|
||||
<path
|
||||
d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z"
|
||||
/>
|
||||
</svg>
|
||||
),
|
||||
linkedin: (
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" width="20" height="20">
|
||||
<path
|
||||
d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"
|
||||
/>
|
||||
</svg>
|
||||
),
|
||||
email: (
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" width="20" height="20">
|
||||
<rect x="2" y="4" width="20" height="16" rx="2" />
|
||||
<path d="M22 4l-10 8L2 4" />
|
||||
</svg>
|
||||
),
|
||||
}
|
||||
|
||||
interface SocialLinksProps {
|
||||
links: SocialLink[]
|
||||
className?: string
|
||||
}
|
||||
export function SocialLinks() {
|
||||
const { lang } = useLanguage()
|
||||
|
||||
export function SocialLinks({ links, className = "" }: SocialLinksProps) {
|
||||
return (
|
||||
<div className={`social-links ${className}`}>
|
||||
{links.map((link) => (
|
||||
<div className="social-links">
|
||||
{socialLinks.map((link) => (
|
||||
<motion.a
|
||||
key={link.label}
|
||||
key={link.id}
|
||||
href={link.href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
target={link.external ? "_blank" : undefined}
|
||||
rel={link.external ? "noopener noreferrer" : undefined}
|
||||
className="social-link"
|
||||
aria-label={link["aria-label"]}
|
||||
aria-label={strings.social.aria[link.id][lang]}
|
||||
whileHover={{ scale: 1.1 }}
|
||||
whileTap={{ scale: 0.9 }}
|
||||
>
|
||||
{link.icon}
|
||||
{icons[link.id]}
|
||||
</motion.a>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
export const navPaths = ['/', '/about', '/experience', '/projects', '/contact', '/philosophy'] as const
|
||||
|
||||
export const footerPaths = ['/', '/about', '/projects', '/contact'] as const
|
||||
@@ -0,0 +1,12 @@
|
||||
import { profile } from '@/data/profile'
|
||||
import type { SocialId } from '@/types'
|
||||
|
||||
export const socialLinks: {
|
||||
id: SocialId
|
||||
href: string
|
||||
external: boolean
|
||||
}[] = [
|
||||
{ id: 'github', href: profile.githubUrl, external: true },
|
||||
{ id: 'linkedin', href: profile.linkedinUrl, external: true },
|
||||
{ id: 'email', href: `mailto:${profile.email}`, external: false },
|
||||
]
|
||||
+20
-6
@@ -6,8 +6,27 @@ export const strings = {
|
||||
projects: {en: 'Projects', vi: 'Dự án'},
|
||||
philosophy: {en: 'Philosophy', vi: 'Triết lý'},
|
||||
contact: {en: 'Contact', vi: 'Liên hệ'},
|
||||
palette: {en: 'Theme color', vi: 'Màu giao diện'},
|
||||
palette: {en: 'Theme', vi: 'Giao diện'},
|
||||
paletteAria: {en: 'Switch theme color', vi: 'Đổi màu giao diện'},
|
||||
menuAria: {en: 'Site menu', vi: 'Menu trang'},
|
||||
openMenu: {en: 'Open menu', vi: 'Mở menu'},
|
||||
closeMenu: {en: 'Close menu', vi: 'Đóng menu'},
|
||||
groupMenu: {en: 'Menu', vi: 'Menu'},
|
||||
groupAppearance: {en: 'Appearance', vi: 'Giao diện'},
|
||||
themeGroup: {en: 'Mode', vi: 'Chế độ'},
|
||||
themeDark: {en: 'Dark', vi: 'Tối'},
|
||||
themeLight: {en: 'Light', vi: 'Sáng'},
|
||||
langGroup: {en: 'Language', vi: 'Ngôn ngữ'},
|
||||
langEn: {en: 'English', vi: 'English'},
|
||||
langVi: {en: 'Tiếng Việt', vi: 'Tiếng Việt'},
|
||||
},
|
||||
social: {
|
||||
heading: {en: 'Connect', vi: 'Kết nối'},
|
||||
aria: {
|
||||
github: {en: 'View GitHub profile', vi: 'Xem hồ sơ GitHub'},
|
||||
linkedin: {en: 'View LinkedIn profile', vi: 'Xem hồ sơ LinkedIn'},
|
||||
email: {en: 'Send email', vi: 'Gửi email'},
|
||||
},
|
||||
},
|
||||
footer: {
|
||||
copyright: {en: 'All rights reserved', vi: 'Bảo lưu mọi quyền'},
|
||||
@@ -103,11 +122,6 @@ export const strings = {
|
||||
common: {
|
||||
backTo: {en: 'Back to %s', vi: 'Quay lại %s'},
|
||||
resumeDownload: {en: 'Get Resume', vi: 'Tải CV'},
|
||||
socialAriaLabels: {
|
||||
github: {en: 'View GitHub profile', vi: 'Xem hồ sơ GitHub'},
|
||||
linkedin: {en: 'View LinkedIn profile', vi: 'Xem hồ sơ LinkedIn'},
|
||||
email: {en: 'Send email', vi: 'Gửi email'},
|
||||
},
|
||||
contactTag: {en: 'Contact', vi: 'Liên hệ'},
|
||||
experienceTag: {en: 'Experience', vi: 'Kinh nghiệm'},
|
||||
},
|
||||
|
||||
+4
-21
@@ -140,13 +140,15 @@
|
||||
color-scheme: light;
|
||||
}
|
||||
|
||||
/* Picker previews: fixed identity colors so a row previews its own palette,
|
||||
not the one currently active. Never referenced outside .nav-palette-preview. */
|
||||
/* Fixed identity colours: a picker row previews its own palette rather than the active one,
|
||||
and the bar's palette icon keeps a constant "empty" half in both themes. Referenced only by
|
||||
`.nav-palette-preview` (previews) and `.nav-palette-swatch` (the empty half). */
|
||||
:root {
|
||||
--preview-red-accent: #b04138;
|
||||
--preview-red-bg: #f6f5f2;
|
||||
--preview-blue-accent: #2563eb;
|
||||
--preview-blue-bg: #f4f6f9;
|
||||
--swatch-empty: #ffffff;
|
||||
}
|
||||
|
||||
/* Pre-hydration / no-JS: honour an OS light preference */
|
||||
@@ -347,22 +349,3 @@ pre code {
|
||||
scroll-behavior: auto !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Language toggle button */
|
||||
.lang-toggle {
|
||||
background: transparent;
|
||||
border: 1px solid var(--border);
|
||||
color: var(--text-primary);
|
||||
padding: 6px 10px;
|
||||
border-radius: var(--radius-md);
|
||||
cursor: pointer;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.5px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.lang-toggle:hover {
|
||||
border-color: var(--accent);
|
||||
color: var(--accent);
|
||||
}
|
||||
@@ -2,6 +2,8 @@ export type Language = 'en' | 'vi';
|
||||
|
||||
export type Palette = 'red' | 'blue';
|
||||
|
||||
export type SocialId = 'github' | 'linkedin' | 'email';
|
||||
|
||||
export type ProjectCategory =
|
||||
| "software-engineering"
|
||||
| "logistics"
|
||||
|
||||
Reference in new issue
Block a user