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:
dong.nguyen committed 2026-10-17 10:27:36 +07:00
1 parent f2c920d6ad
commit d0aa9958c8
16 files changed
+1386 -311

No files matched your search

+3 -35
View File
@@ -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>
)
+144
View File
@@ -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>
)
}
+70 -45
View File
@@ -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} />
</>
)
}
+9 -26
View File
@@ -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}
+1 -36
View File
@@ -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">
+5 -1
View File
@@ -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)
+34 -17
View File
@@ -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>