From 62dea50131b23a4e388a05de1ddc0a81a1ea44ca Mon Sep 17 00:00:00 2001 From: Ariful Alam Date: Fri, 1 Mar 2024 14:28:35 +0600 Subject: [PATCH] Hide sections 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 ++--- src/components/publication-card/index.tsx | 157 ++++++++++++++++++++ src/utils/index.tsx | 20 ++- 5 files changed, 204 insertions(+), 53 deletions(-) create mode 100644 src/components/publication-card/index.tsx diff --git a/src/components/certification-card/index.tsx b/src/components/certification-card/index.tsx index bda4ed9..73d79fe 100644 --- a/src/components/certification-card/index.tsx +++ b/src/components/certification-card/index.tsx @@ -78,22 +78,15 @@ const CertificationCard = ({ renderSkeleton() ) : ( <> - {certifications - .filter( - (certification) => - certification.year || - certification.name || - certification.body, - ) - .map((certification, index) => ( - - ))} + {certifications.map((certification, index) => ( + + ))} )} diff --git a/src/components/education-card/index.tsx b/src/components/education-card/index.tsx index f21568f..be52948 100644 --- a/src/components/education-card/index.tsx +++ b/src/components/education-card/index.tsx @@ -70,19 +70,14 @@ const EducationCard = ({ renderSkeleton() ) : ( <> - {educations - .filter( - (item) => - item.institution || item.degree || item.from || item.to, - ) - .map((item, index) => ( - - ))} + {educations.map((item, index) => ( + + ))} )} diff --git a/src/components/experience-card/index.tsx b/src/components/experience-card/index.tsx index ff75322..cc58dea 100644 --- a/src/components/experience-card/index.tsx +++ b/src/components/experience-card/index.tsx @@ -75,27 +75,19 @@ const ExperienceCard = ({ renderSkeleton() ) : ( - {experiences - .filter( - (experience) => - experience.company || - experience.position || - experience.from || - experience.to, - ) - .map((experience, index) => ( - - ))} + {experiences.map((experience, index) => ( + + ))} )} diff --git a/src/components/publication-card/index.tsx b/src/components/publication-card/index.tsx new file mode 100644 index 0000000..8ded02b --- /dev/null +++ b/src/components/publication-card/index.tsx @@ -0,0 +1,157 @@ +import React, { Fragment } from 'react'; +import { SanitizedExperience } from '../../interfaces/sanitized-config'; +import { skeleton } from '../../utils'; + +const ListItem = ({ + time, + position, + company, + companyLink, +}: { + time: React.ReactNode; + position?: React.ReactNode; + company?: React.ReactNode; + companyLink?: string; +}) => ( +
  • +
    +
    {time}
    +

    {position}

    + +
  • +); + +const PublicationCard = ({ + experiences, + loading, +}: { + experiences: SanitizedExperience[]; + loading: boolean; +}) => { + const renderSkeleton = () => { + const array = []; + for (let index = 0; index < 2; index++) { + array.push( + , + ); + } + + return array; + }; + return ( +
    +
    +
    +
    +
    +
    +
    + + Publications + +
    +
    +
    +
    + +
    +
    +
    +
    +
    +

    + Publication Title +

    +

    + Conference / Journal Name +

    +

    + Authors: John Doe, Jane Smith +

    +

    + Lorem ipsum dolor sit amet, consectetur + adipiscing elit, sed do eiusmod tempor + incididunt ut labore et dolore magna aliqua. Ut + enim ad minim veniam, quis nostrud exercitation + ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in + reprehenderit in voluptate velit esse cillum + dolore eu fugiat nulla pariatur. Excepteur sint + occaecat cupidatat non proident, sunt in culpa + qui officia deserunt mollit anim id est laborum. +

    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +

    + Publication Title +

    +

    + Conference / Journal Name +

    +

    + Authors: John Doe, Jane Smith +

    +

    + Lorem ipsum dolor sit amet, consectetur + adipiscing elit, sed do eiusmod tempor + incididunt ut labore et dolore magna aliqua. Ut + enim ad minim veniam, quis nostrud exercitation + ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in + reprehenderit in voluptate velit esse cillum + dolore eu fugiat nulla pariatur. Excepteur sint + occaecat cupidatat non proident, sunt in culpa + qui officia deserunt mollit anim id est laborum. +

    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + ); +}; + +export default PublicationCard; diff --git a/src/utils/index.tsx b/src/utils/index.tsx index a1df9c3..3905c96 100644 --- a/src/utils/index.tsx +++ b/src/utils/index.tsx @@ -82,9 +82,23 @@ export const getSanitizedConfig = ( fileUrl: config?.resume?.fileUrl || '', }, skills: config?.skills || [], - experiences: config?.experiences || [], - certifications: config?.certifications || [], - educations: config?.educations || [], + experiences: + config?.experiences?.filter( + (experience) => + experience.company || + experience.position || + experience.from || + experience.to, + ) || [], + certifications: + config?.certifications?.filter( + (certification) => + certification.year || certification.name || certification.body, + ) || [], + educations: + config?.educations?.filter( + (item) => item.institution || item.degree || item.from || item.to, + ) || [], googleAnalytics: { id: config?.googleAnalytics?.id, },