From 22ddd08b4f3925c140fe655427ebde68412967fe Mon Sep 17 00:00:00 2001 From: Ariful Alam Date: Wed, 28 Feb 2024 16:19:21 +0600 Subject: [PATCH] Hide items if required fields are not present --- src/components/certification-card/index.tsx | 25 +++++++++------ src/components/education-card/index.tsx | 21 ++++++++----- src/components/experience-card/index.tsx | 34 +++++++++++++-------- 3 files changed, 50 insertions(+), 30 deletions(-) diff --git a/src/components/certification-card/index.tsx b/src/components/certification-card/index.tsx index 0a605b5..bda4ed9 100644 --- a/src/components/certification-card/index.tsx +++ b/src/components/certification-card/index.tsx @@ -78,15 +78,22 @@ const CertificationCard = ({ renderSkeleton() ) : ( <> - {certifications.map((certification, index) => ( - - ))} + {certifications + .filter( + (certification) => + certification.year || + certification.name || + certification.body, + ) + .map((certification, index) => ( + + ))} )} diff --git a/src/components/education-card/index.tsx b/src/components/education-card/index.tsx index be52948..f21568f 100644 --- a/src/components/education-card/index.tsx +++ b/src/components/education-card/index.tsx @@ -70,14 +70,19 @@ const EducationCard = ({ renderSkeleton() ) : ( <> - {educations.map((item, index) => ( - - ))} + {educations + .filter( + (item) => + item.institution || item.degree || item.from || item.to, + ) + .map((item, index) => ( + + ))} )} diff --git a/src/components/experience-card/index.tsx b/src/components/experience-card/index.tsx index cc58dea..ff75322 100644 --- a/src/components/experience-card/index.tsx +++ b/src/components/experience-card/index.tsx @@ -75,19 +75,27 @@ const ExperienceCard = ({ renderSkeleton() ) : ( - {experiences.map((experience, index) => ( - - ))} + {experiences + .filter( + (experience) => + experience.company || + experience.position || + experience.from || + experience.to, + ) + .map((experience, index) => ( + + ))} )}