Hide items if required fields are not present

This commit is contained in:
Ariful Alam 2024-02-28 16:19:21 +06:00
parent 960c9f76cb
commit 22ddd08b4f
3 changed files with 50 additions and 30 deletions

View File

@ -78,15 +78,22 @@ const CertificationCard = ({
renderSkeleton()
) : (
<>
{certifications.map((certification, index) => (
<ListItem
key={index}
year={`${certification.year}`}
name={certification.name}
body={certification.body}
link={certification.link ? certification.link : undefined}
/>
))}
{certifications
.filter(
(certification) =>
certification.year ||
certification.name ||
certification.body,
)
.map((certification, index) => (
<ListItem
key={index}
year={certification.year}
name={certification.name}
body={certification.body}
link={certification.link}
/>
))}
</>
)}
</ol>

View File

@ -70,14 +70,19 @@ const EducationCard = ({
renderSkeleton()
) : (
<>
{educations.map((item, index) => (
<ListItem
key={index}
time={`${item.from} - ${item.to}`}
degree={item.degree}
institution={item.institution}
/>
))}
{educations
.filter(
(item) =>
item.institution || item.degree || item.from || item.to,
)
.map((item, index) => (
<ListItem
key={index}
time={`${item.from} - ${item.to}`}
degree={item.degree}
institution={item.institution}
/>
))}
</>
)}
</ol>

View File

@ -75,19 +75,27 @@ const ExperienceCard = ({
renderSkeleton()
) : (
<Fragment>
{experiences.map((experience, index) => (
<ListItem
key={index}
time={`${experience.from} - ${experience.to}`}
position={experience.position}
company={experience.company}
companyLink={
experience.companyLink
? experience.companyLink
: undefined
}
/>
))}
{experiences
.filter(
(experience) =>
experience.company ||
experience.position ||
experience.from ||
experience.to,
)
.map((experience, index) => (
<ListItem
key={index}
time={`${experience.from} - ${experience.to}`}
position={experience.position}
company={experience.company}
companyLink={
experience.companyLink
? experience.companyLink
: undefined
}
/>
))}
</Fragment>
)}
</ol>