/** * @license * SPDX-License-Identifier: Apache-2.0 */ import React, { useRef, useEffect } from 'react'; import type { ResumeSection, ResumeSectionType } from '../lib/types'; interface EditableSectionProps { section: ResumeSection; onContentChange: (sectionId: ResumeSectionType, newContent: string) => void; isActive: boolean; onFocus: (sectionId: ResumeSectionType, content: string) => void; onBlur: () => void; } export default function EditableSection({ section, onContentChange, isActive, onFocus, onBlur, }: EditableSectionProps) { const contentRef = useRef(null); useEffect(() => { if (contentRef.current && section.content !== contentRef.current.innerText) { contentRef.current.innerText = section.content; } }, [section.content]); const handleInput = (e: React.FormEvent) => { onContentChange(section.id, e.currentTarget.innerText); }; return (
onFocus(section.id, contentRef.current?.innerText || '')} onBlur={onBlur} >

{section.title}

); }