Skip to content

Commit

Permalink
Merge pull request #520 from arifszn/handle-empty-section-item
Browse files Browse the repository at this point in the history
Handle empty section item
  • Loading branch information
arifszn authored Feb 28, 2024
2 parents 960c9f7 + be0e616 commit 0b7eed4
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 32 deletions.
25 changes: 16 additions & 9 deletions src/components/certification-card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
21 changes: 13 additions & 8 deletions src/components/education-card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
34 changes: 21 additions & 13 deletions src/components/experience-card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
4 changes: 2 additions & 2 deletions src/components/github-project-card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ const GithubProjectCard = ({
<div className="flex justify-between flex-col p-8 h-full w-full">
<div>
<div className="flex items-center">
<div className="card-title text-lg tracking-wide flex text-base-content opacity-60">
<div className="card-title text-lg tracking-wide flex text-base-content opacity-60 truncate">
<MdInsertLink className="my-auto" />
<span>{item.name}</span>
<span className="truncate">{item.name}</span>
</div>
</div>
<p className="mb-5 mt-1 text-base-content text-opacity-60 text-sm">
Expand Down

0 comments on commit 0b7eed4

Please sign in to comment.