diff --git a/cv-project/src/App.jsx b/cv-project/src/App.jsx
index 3a2a6ad..72484ca 100644
--- a/cv-project/src/App.jsx
+++ b/cv-project/src/App.jsx
@@ -1,15 +1,42 @@
-import GeneralInfo from "./components/generalInfo";
-import EducationInfo from "./components/educationInfo";
-import Experience from "./components/experience";
+import GeneralInfoForm from "./components/generalInfoForm";
+import GeneralInfoDisplay from "./components/generalInfoDisplay";
+import EducationInfoDisplay from "./components/educationInfoDisplay";
+import EducationInfoForm from "./components/educationInfoForm";
+import ExperienceForm from "./components/experienceForm";
import "./App.css";
+import { useState } from "react";
function App() {
+ const [basicInfo, setBasicInfo] = useState({
+ firstName: "",
+ lastName: "",
+ phone: "",
+ email: "",
+ });
+ const [educationInfo, setEducationInfo] = useState([]);
+ const [editEducation, setEditEducation] = useState(null);
+
return (
- <>
-
-
-
- >
+
+ {props.educationInfo.map((item) => {
+ return (
+
+
School: {item.schoolName}
+
+ Graduation Date: {item.graduationDate + " "}
+ Field of Study: {item.fieldOfStudy}
+
+
+
+
+ );
+ })}
+
+ );
+}
+
+function deleteEducationItem(educationInfo, item, setEducationInfo) {
+ const filteredSchools = educationInfo.filter(
+ (school) => school.schoolName !== item,
+ );
+ setEducationInfo(filteredSchools);
+}
diff --git a/cv-project/src/components/educationInfo.jsx b/cv-project/src/components/educationInfoForm.jsx
similarity index 59%
rename from cv-project/src/components/educationInfo.jsx
rename to cv-project/src/components/educationInfoForm.jsx
index 78bfd3a..c94fdfc 100644
--- a/cv-project/src/components/educationInfo.jsx
+++ b/cv-project/src/components/educationInfoForm.jsx
@@ -1,29 +1,12 @@
import { useState, useEffect } from "react";
-export default function EducationInfo() {
- const [schools, setSchools] = useState([]);
+export default function EducationInfoForm(props) {
+ // const [schools, setSchools] = useState([]);
const [educationItemActive, setEducationItemActive] = useState(false);
- const [editSchool, setEditSchool] = useState(null);
-
- const mainDivStyle = {
- display: "flex",
- justifyContent: "space-between",
- flexDirection: "row-reverse",
- };
+ // const [editSchool, setEditSchool] = useState(null);
return (
-
- {schools.length <= 0 ? (
- <>
-
Add your Education info
- >
- ) : (
-
- )}
+
);
}
-function EducationDisplay(props) {
- return (
-
- {props.schools.map((item) => {
- return (
-
-
School: {item.schoolName}
-
- Graduation Date: {item.graduationDate + " "}
- Field of Study: {item.fieldOfStudy}
-
-
-
-
- );
- })}
-
- );
-}
-
-function EducationForm({ isActive, schools, setSchools, editSchool }) {
+function EducationForm({
+ isActive,
+ educationInfo,
+ setEducationInfo,
+ editSchool,
+}) {
const [graduationDate, setGraduationDate] = useState("");
const [schoolName, setSchoolName] = useState("");
const [fieldOfStudy, setFieldOfStudy] = useState("");
@@ -92,7 +50,9 @@ function EducationForm({ isActive, schools, setSchools, editSchool }) {
}, [editSchool]);
let schoolId = editSchool
- ? schools.findIndex((school) => school.schoolName === editSchool.schoolName)
+ ? educationInfo.findIndex(
+ (school) => school.schoolName === editSchool.schoolName,
+ )
: null;
const contactFormStyle = {
@@ -128,17 +88,17 @@ function EducationForm({ isActive, schools, setSchools, editSchool }) {
type="submit"
onClick={(e) => {
e.preventDefault();
- const updatedSchools = [...schools];
+ const updatedSchools = [...educationInfo];
if (schoolId !== -1 && schoolId !== null) {
updatedSchools[schoolId] = {
schoolName: schoolName,
graduationDate: graduationDate,
fieldOfStudy: fieldOfStudy,
};
- setSchools(updatedSchools);
+ setEducationInfo(updatedSchools);
} else {
- setSchools([
- ...schools,
+ setEducationInfo([
+ ...educationInfo,
{
schoolName: schoolName,
fieldOfStudy: fieldOfStudy,
@@ -170,10 +130,3 @@ function EducationForm({ isActive, schools, setSchools, editSchool }) {
);
}
-
-function deleteEducationItem(schools, item, setSchools) {
- const filteredSchools = schools.filter(
- (school) => school.schoolName !== item,
- );
- setSchools(filteredSchools);
-}
diff --git a/cv-project/src/components/experience.jsx b/cv-project/src/components/experienceForm.jsx
similarity index 98%
rename from cv-project/src/components/experience.jsx
rename to cv-project/src/components/experienceForm.jsx
index 0ef96b6..854c292 100644
--- a/cv-project/src/components/experience.jsx
+++ b/cv-project/src/components/experienceForm.jsx
@@ -1,6 +1,6 @@
import { useState } from "react";
-export default function Experience() {
+export default function ExperienceForm() {
const [jobs, setJobs] = useState([]);
const [showJobForm, setShowJobForm] = useState(false);
diff --git a/cv-project/src/components/generalInfoDisplay.jsx b/cv-project/src/components/generalInfoDisplay.jsx
new file mode 100644
index 0000000..5b4621d
--- /dev/null
+++ b/cv-project/src/components/generalInfoDisplay.jsx
@@ -0,0 +1,18 @@
+export default function GeneralInfoDisplay(props) {
+ const basicInfo = props.basicInfo;
+ return (
+ <>
+ {
+ basicInfo ?
+ (
+