diff --git a/apps/fronted/src/components/preview/CustomSection.tsx b/apps/fronted/src/components/preview/CustomSection.tsx index 976e872..bdf4947 100644 --- a/apps/fronted/src/components/preview/CustomSection.tsx +++ b/apps/fronted/src/components/preview/CustomSection.tsx @@ -1,7 +1,7 @@ "use client"; -import { motion } from "framer-motion"; -import { GlobalSettings, CustomItem } from "@/types/resume"; +import { AnimatePresence, motion } from "framer-motion"; import SectionTitle from "./SectionTitle"; +import { GlobalSettings, CustomItem } from "@/types/resume"; interface CustomSectionProps { sectionId: string; @@ -31,58 +31,61 @@ const CustomSection = ({ type="custom" globalSettings={globalSettings} /> - {visibleItems.map((item) => ( -
-
-
-
-

- {item.title} -

- + {visibleItems.map((item) => ( + +
+
+
+

+ {item.title} +

+ + {item.subtitle} + +
+
+ {item.dateRange && ( + - {item.subtitle} - -
+ {item.dateRange} + + )}
- {item.dateRange && ( - - {item.dateRange} - + dangerouslySetInnerHTML={{ __html: item.description }} + /> )} -
- {item.description && ( -
- )} -
- ))} + + ))} + ); }; diff --git a/apps/fronted/src/components/preview/EducationSection.tsx b/apps/fronted/src/components/preview/EducationSection.tsx index 8289a2e..b113b33 100644 --- a/apps/fronted/src/components/preview/EducationSection.tsx +++ b/apps/fronted/src/components/preview/EducationSection.tsx @@ -1,5 +1,5 @@ "use client"; -import { motion } from "framer-motion"; +import { AnimatePresence, motion } from "framer-motion"; import { Education, GlobalSettings } from "@/types/resume"; import SectionTitle from "./SectionTitle"; interface EducationSectionProps { @@ -14,7 +14,6 @@ const EducationSection = ({ const visibleEducation = education?.filter((edu) => edu.visible); return ( - - {visibleEducation?.map((edu) => ( -
-
-
-
-

- {edu.school} -

- {edu.location && ( - + {visibleEducation?.map((edu) => ( + +
+
+
+

- · {edu.location} - - )} + {edu.school} +

+ {edu.location && ( + + · {edu.location} + + )} +
+

+ {[edu.major, edu.degree].filter(Boolean).join(" · ")} + {edu.gpa && ` · GPA ${edu.gpa}`} +

-

- {[edu.major, edu.degree].filter(Boolean).join(" · ")} - {edu.gpa && ` · GPA ${edu.gpa}`} -

+ {`${new Date(edu.startDate).toLocaleDateString()} - ${new Date(edu.endDate).toLocaleDateString()}`} +
- - {`${new Date(edu.startDate).toLocaleDateString()} - ${new Date(edu.endDate).toLocaleDateString()}`} - -
- {edu.description && ( -
- )} -
- ))} + {edu.description && ( +
+ )} + + ))} + ); }; diff --git a/apps/fronted/src/components/preview/ExperienceSection.tsx b/apps/fronted/src/components/preview/ExperienceSection.tsx index 754ce86..bdfb579 100644 --- a/apps/fronted/src/components/preview/ExperienceSection.tsx +++ b/apps/fronted/src/components/preview/ExperienceSection.tsx @@ -1,16 +1,59 @@ -import { motion } from "framer-motion"; +"use client"; +import React from "react"; +import { motion, AnimatePresence } from "framer-motion"; import { Experience, GlobalSettings } from "@/types/resume"; import SectionTitle from "./SectionTitle"; interface ExperienceSectionProps { - experience: Experience[]; - globalSettings: GlobalSettings | undefined; + experiences?: Experience[]; + globalSettings?: GlobalSettings; } -const ExperienceSection = ({ - experience, +interface ExperienceItemProps { + experience: Experience; + globalSettings?: GlobalSettings; +} + +const ExperienceItem: React.FC = React.forwardRef( + ({ experience, globalSettings }, ref) => { + return ( + + +
{experience.company}
+ {experience.date &&
{experience.date}
} +
+ {experience.position && ( + + {experience.position} + + )} + {experience.details && ( + + )} +
+ ); + } +); + +const ExperienceSection: React.FC = ({ + experiences, globalSettings, -}: ExperienceSectionProps) => { +}) => { + if (!experiences?.length) return null; + + const visibleExperiences = experiences.filter( + (experience) => experience.visible + ); + return ( - {experience?.map( - (exp) => - exp.visible && ( -
-
-
-

- {exp.company} -

-

- {exp.position} -

-
- - {exp.date} - -
-
-
- ) - )} +
+ + {visibleExperiences.map((experience) => ( + + ))} + +
); }; diff --git a/apps/fronted/src/components/preview/ProjectSection.tsx b/apps/fronted/src/components/preview/ProjectSection.tsx index 4617995..70e4911 100644 --- a/apps/fronted/src/components/preview/ProjectSection.tsx +++ b/apps/fronted/src/components/preview/ProjectSection.tsx @@ -1,5 +1,7 @@ +"use client"; + import React from "react"; -import { motion } from "framer-motion"; +import { motion, AnimatePresence } from "framer-motion"; import SectionTitle from "./SectionTitle"; import { Project, GlobalSettings } from "@/types/resume"; @@ -14,6 +16,8 @@ const ProjectSection: React.FC = ({ }) => { if (!projects?.length) return null; + const visibleProjects = projects.filter((project) => project.visible); + return ( = ({ type="projects" globalSettings={globalSettings} > -
- {projects.map((project) => ( - - ))} +
+ + {visibleProjects.map((project) => ( + + ))} +
); @@ -43,33 +49,40 @@ interface ProjectItemProps { globalSettings?: GlobalSettings; } -const ProjectItem: React.FC = ({ - project, - globalSettings, -}) => { - return ( -
-
-

{project.name}

-
{project.date}
-
- {project.role && ( -
{project.role}
- )} - {project.description && ( -
- )} -
- ); -}; +const ProjectItem: React.FC = React.forwardRef( + ({ project, globalSettings }, ref) => { + return ( + + +

{project.name}

+ {project.date &&
{project.date}
} +
+ {project.role && ( + + {project.role} + + )} + {project.description && ( + + )} +
+ ); + } +); export default ProjectSection; diff --git a/apps/fronted/src/components/preview/SectionTitle.tsx b/apps/fronted/src/components/preview/SectionTitle.tsx index fbe8bd9..451395b 100644 --- a/apps/fronted/src/components/preview/SectionTitle.tsx +++ b/apps/fronted/src/components/preview/SectionTitle.tsx @@ -1,3 +1,4 @@ +"use client"; import { useMemo } from "react"; import { GlobalSettings } from "@/types/resume"; import { useResumeStore } from "@/store/useResumeStore"; diff --git a/apps/fronted/src/components/preview/SkillPanel.tsx b/apps/fronted/src/components/preview/SkillPanel.tsx index 164f99a..3161072 100644 --- a/apps/fronted/src/components/preview/SkillPanel.tsx +++ b/apps/fronted/src/components/preview/SkillPanel.tsx @@ -1,6 +1,7 @@ +"use client"; import { motion } from "framer-motion"; -import { GlobalSettings } from "@/types/resume"; import SectionTitle from "./SectionTitle"; +import { GlobalSettings } from "@/types/resume"; interface SkillSectionProps { skill: string | undefined; diff --git a/apps/fronted/src/components/templates/ClassicTemplate.tsx b/apps/fronted/src/components/templates/ClassicTemplate.tsx index 63c11a4..58f1752 100644 --- a/apps/fronted/src/components/templates/ClassicTemplate.tsx +++ b/apps/fronted/src/components/templates/ClassicTemplate.tsx @@ -36,7 +36,7 @@ const ClassicTemplate: React.FC = ({ case "experience": return ( ); diff --git a/apps/fronted/src/components/templates/LeftRightTemplate.tsx b/apps/fronted/src/components/templates/LeftRightTemplate.tsx index c82d3b9..7483519 100644 --- a/apps/fronted/src/components/templates/LeftRightTemplate.tsx +++ b/apps/fronted/src/components/templates/LeftRightTemplate.tsx @@ -35,7 +35,7 @@ const LeftRightTemplate: React.FC = ({ case "experience": return ( ); diff --git a/apps/fronted/src/components/templates/ModernTemplate.tsx b/apps/fronted/src/components/templates/ModernTemplate.tsx index 357bdd9..99ce244 100644 --- a/apps/fronted/src/components/templates/ModernTemplate.tsx +++ b/apps/fronted/src/components/templates/ModernTemplate.tsx @@ -33,7 +33,7 @@ const ModernTemplate: React.FC = ({ data, template }) => { case "experience": return ( ); @@ -92,7 +92,7 @@ const ModernTemplate: React.FC = ({ data, template }) => {