From da43c079b0de45fb125be51e922459a5b95369e2 Mon Sep 17 00:00:00 2001 From: Szymon Kin <68154191+hoolek77@users.noreply.github.com> Date: Mon, 28 Nov 2022 20:22:09 +0100 Subject: [PATCH] Create projects section (#99) --- .../organisms/project-timeline-item.astro | 118 ++++++++++-------- .../organisms/work-timeline-item.astro | 12 +- .../sections/portfolio-section.astro | 17 ++- src/pages/index.astro | 2 +- src/pages/playground/projects-timeline.astro | 2 +- 5 files changed, 88 insertions(+), 63 deletions(-) diff --git a/src/components/organisms/project-timeline-item.astro b/src/components/organisms/project-timeline-item.astro index f60ab00..f690cd7 100644 --- a/src/components/organisms/project-timeline-item.astro +++ b/src/components/organisms/project-timeline-item.astro @@ -9,74 +9,82 @@ import Typography from '@/atoms/typography.astro'; import type { I18n } from '@/types/i18n'; import type { Project } from '@/types/portfolio-section'; -export interface Props extends astroHTML.JSX.HTMLAttributes { - value: Project; +export interface Props { + project: Project; i18n: I18n; } -const { value, i18n, ...props } = Astro.props; -const ProjectTimelineItem = 'div'; +const { project, i18n } = Astro.props; +const { description, details, endDate, name, socials, startDate, tags, image } = project; -const setLabelValue = (val: string | string[]) => - Array.isArray(val) ? val.map((v, id) => (id !== val.length - 1 ? v.concat(', ') : v)) : val; +// Alt has to destructured separately, because otherwise eslint complains about +// the missing alt attribute on the Image component. +const { alt, ...sharedImageProps } = { + src: image, + aspectRatio: '1/1', + alt: `Thumbnail for ${name} project`, + format: 'webp', +} as const; --- - -
- {''} -
-
- {value.name} -
a]:my-2']}> - {value.socials?.map(({ icon, url }) => )} -
-
- +
+
+
{''} -
-
- { - value.details - .slice(0, Math.round(value.details.length / 2)) - .map((d) => ) - } +
+
+
+ {name} + +
+
+ {socials?.map(({ icon, url }) => )} +
-
+ {alt} +
{ - value.details - .slice(Math.round(value.details.length / 2)) - .map((d) => ) + details.map(({ label: detailLabel, value: detailValue }) => ( + + )) }
- {value.description} -
-
- { - value.tags.map((t) => ( - - {t.name} - - )) - } + {description}
- +
+ { + tags.map(({ name: tagName, icon, iconColor, url }) => { + return url ? ( + + + {tagName} + + + ) : ( + + {tagName} + + ); + }) + } +
+
diff --git a/src/components/organisms/work-timeline-item.astro b/src/components/organisms/work-timeline-item.astro index e615a47..c64d8cd 100644 --- a/src/components/organisms/work-timeline-item.astro +++ b/src/components/organisms/work-timeline-item.astro @@ -15,11 +15,13 @@ const WorkTimelineItem = 'div'; --- -
- {job.role} — {job.company} - -
a]:mb-2', 'md:[&>a]:my-2']}> +
+
+ {job.role} — {job.company} + +
+
{job.socials?.map(({ icon, url }) => )}
diff --git a/src/components/sections/portfolio-section.astro b/src/components/sections/portfolio-section.astro index 8f9d557..07ede21 100644 --- a/src/components/sections/portfolio-section.astro +++ b/src/components/sections/portfolio-section.astro @@ -1,13 +1,20 @@ --- +import Divider from '@/atoms/divider.astro'; import SectionCard from '@/atoms/section-card.astro'; import Typography from '@/atoms/typography.astro'; +import ProjectTimelineItem from '@/organisms/project-timeline-item.astro'; import type { Section } from '@/types/data'; +import type { I18n } from '@/types/i18n'; import type { PortfolioSection } from '@/types/portfolio-section'; -export interface Props extends PortfolioSection {} +export interface Props extends PortfolioSection { + i18n: I18n; +} const { config: { title }, + projects, + i18n, } = Astro.props; const section: Section = 'portfolio'; @@ -15,4 +22,12 @@ const section: Section = 'portfolio'; {title} + { + projects.map((project, index) => ( + <> + + {index !== projects.length - 1 && } + + )) + } diff --git a/src/pages/index.astro b/src/pages/index.astro index ce58a2b..ccbd62d 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -53,7 +53,7 @@ const { seo, i18n, ...dataWithoutSeoAndI18n } = data; ) } - {data.portfolio && } + {data.portfolio && } {data.testimonials && } {data.favorites && } diff --git a/src/pages/playground/projects-timeline.astro b/src/pages/playground/projects-timeline.astro index 72dd0c8..028b131 100644 --- a/src/pages/playground/projects-timeline.astro +++ b/src/pages/playground/projects-timeline.astro @@ -63,5 +63,5 @@ const i18nData: I18n = { ---
- +