import { AnimatePresence, motion } from 'motion/react' import { useEffect } from 'react' import { resumeUrlFor, resumeLanguages, resumeLanguageLabels } from '@/data/resume' import { useLanguage } from '@/hooks/useLanguage' import { strings } from '@/i18n/strings' type ResumeDialogProps = { open: boolean close: () => void panelRef: React.RefObject dialogId: string } /** * 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. */ export function ResumeDialog({ open, close, panelRef, dialogId }: ResumeDialogProps) { const { lang } = useLanguage() // Enter only, one frame late so the panel is on screen before it takes focus. AnimatePresence // keeps the open=true props on its exiting copy, so an onAnimationComplete handler fires again // when the exit animation ends and strands focus on as the panel unmounts. useEffect(() => { if (!open) return const frame = requestAnimationFrame(() => panelRef.current?.focus()) return () => cancelAnimationFrame(frame) }, [open, panelRef]) return ( {open && ( event.stopPropagation()} >

{strings.common.resumeModalTitle[lang]}

{strings.common.resumeModalHint[lang]}

{resumeLanguages.map(optionLang => ( {resumeLanguageLabels[optionLang]} {resumeUrlFor(optionLang)} ))}
)}
) }