import { useState } from 'react'; import { Plus, Edit2, Trash2, X, Check } from 'lucide-react'; export default function ExperienceForm({ data, onUpdate }) { const [editingId, setEditingId] = useState(null); const [editForm, setEditForm] = useState(null); const defaultForm = { role: '', company: '', period: '', type: 'Vollzeit', description: '', highlights: [] }; const startAdd = () => { setEditingId('new'); setEditForm({ ...defaultForm, id: Date.now() }); }; const startEdit = (exp) => { setEditingId(exp.id); setEditForm({ ...exp }); }; const cancelEdit = () => { setEditingId(null); setEditForm(null); }; const saveEdit = () => { if (!editForm.role || !editForm.company) return; if (editingId === 'new') { onUpdate([...data, editForm]); } else { onUpdate(data.map(e => e.id === editingId ? editForm : e)); } cancelEdit(); }; const deleteItem = (id) => { onUpdate(data.filter(e => e.id !== id)); }; const addHighlight = () => { setEditForm(prev => ({ ...prev, highlights: [...(prev.highlights || []), ''] })); }; const updateHighlight = (index, value) => { setEditForm(prev => ({ ...prev, highlights: prev.highlights.map((h, i) => i === index ? value : h) })); }; const removeHighlight = (index) => { setEditForm(prev => ({ ...prev, highlights: prev.highlights.filter((_, i) => i !== index) })); }; return (

Berufserfahrung

{editingId !== 'new' && ( )}
{editingId === 'new' && editForm && (
)}
{data.map((exp) => (
{editingId === exp.id ? (
) : (

{exp.role}

{exp.company} • {exp.period}

{exp.type}
)}
))}
); } function EditForm({ form, setForm, onSave, onCancel, onAddHighlight, onUpdateHighlight, onRemoveHighlight }) { const handleChange = (e) => { const { name, value } = e.target; setForm(prev => ({ ...prev, [name]: value })); }; return (