diff --git a/src/components/CVPreview/CVEducation.jsx b/src/components/CVPreview/CVEducation.jsx new file mode 100644 index 0000000..4a10055 --- /dev/null +++ b/src/components/CVPreview/CVEducation.jsx @@ -0,0 +1,168 @@ +import { useState } from 'react'; +import { FaEdit, FaSave, FaTimes, FaPlus, FaMinus } from 'react-icons/fa'; +import styles from './CVEducation.module.css'; + +const CVEducation = ({ education = [], onSave }) => { + const [isEditing, setIsEditing] = useState(false); + const [editData, setEditData] = useState([...education]); + + const handleChange = (index, field, value) => { + const newData = [...editData]; + newData[index] = { + ...newData[index], + [field]: value + }; + setEditData(newData); + }; + + const addEducation = () => { + setEditData([ + ...editData, + { + program: '', + institution: '', + startDate: '', + endDate: '', + highlights: '' + } + ]); + }; + + const removeEducation = (index) => { + const newData = [...editData]; + newData.splice(index, 1); + setEditData(newData); + }; + + const handleSave = () => { + onSave(editData); + setIsEditing(false); + }; + + const handleCancel = () => { + setEditData([...education]); + setIsEditing(false); + }; + + if (isEditing) { + return ( +
+
+

Education

+
+ + +
+
+
+ + {editData.map((edu, index) => ( +
+
+ + handleChange(index, 'program', e.target.value)} + /> +
+
+ + handleChange(index, 'institution', e.target.value)} + /> +
+
+ + handleChange(index, 'startDate', e.target.value)} + /> +
+
+ + handleChange(index, 'endDate', e.target.value)} + /> +
+
+ +