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 { useI18n } from '@/i18n/provider' import { RollingTextLink } from '@/components/ui/RollingTextLink' import { SocialLinks } from '@/components/ui/SocialLinks' import { LanguageIcon } from '@/components/ui/LanguageIcon' import { MoonIcon, SunIcon } from '@/components/ui/icons' interface MobileMenuProps { open: boolean onClose: () => void } export function MobileMenu({ open, onClose }: MobileMenuProps) { const { lang, setLang } = useLanguage() const { ui: s } = useI18n() const { resolvedTheme, setTheme, palette, setPalette } = useTheme() const location = useLocation() const reduceMotion = useReducedMotion() const sheetRef = useRef(null) return ( {open && ( sheetRef.current?.focus()} >
{s.nav.groupAppearance}
{s.nav.langGroup}
{/* Icons, not words — globe for English, red flag for Tiếng Việt — in the same 44px icon-only shape as the Theme color row. An icon cannot say which language it is, so each option carries its own-language name in aria-label and title. */}
{s.nav.themeGroup}
{/* Icons, not words — the bar's own line art: moon for dark, sun for light. An icon alone cannot name a mode, so each option carries the translated mode name in aria-label and title. */}
{s.nav.palette}
{paletteIds.map((id) => ( ))}
{s.social.heading}
)}
) }