2025-02-16 12:01:51 +01:00
|
|
|
---
|
|
|
|
import type { Project } from "@/types/types"
|
|
|
|
import type { NavLink } from "@/utils/linking"
|
|
|
|
import ProjectCard from "./ProjectCard.astro"
|
2025-02-27 21:13:01 +01:00
|
|
|
import dayjs from "dayjs"
|
2025-02-16 12:01:51 +01:00
|
|
|
|
|
|
|
interface Props {
|
|
|
|
projects: ReadonlyArray<Project>
|
|
|
|
}
|
|
|
|
|
|
|
|
const { projects } = Astro.props
|
|
|
|
|
|
|
|
const baseUrl: NavLink = "/projects"
|
|
|
|
---
|
|
|
|
|
|
|
|
<div class="flex flex-wrap justify-around">
|
|
|
|
{
|
2025-02-27 21:13:01 +01:00
|
|
|
projects
|
|
|
|
.toSorted((a, b) =>
|
|
|
|
dayjs(a.data.updatedAt).isBefore(dayjs(b.data.updatedAt)) ? 1 : -1,
|
|
|
|
)
|
|
|
|
.map(
|
|
|
|
({
|
|
|
|
data: { title, description, tags, heroImage, heroImageAlt },
|
|
|
|
id,
|
|
|
|
}) => (
|
|
|
|
<div class="my-5 px-2">
|
|
|
|
<ProjectCard
|
|
|
|
title={title}
|
|
|
|
linkTo={`${baseUrl}/${id}`}
|
|
|
|
description={description}
|
|
|
|
tags={tags}
|
|
|
|
image={heroImage}
|
|
|
|
imageAlt={heroImageAlt}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
),
|
|
|
|
)
|
2025-02-16 12:01:51 +01:00
|
|
|
}
|
|
|
|
</div>
|