From 982589927fd4bd2f31ef3e72f30693821e051b1c Mon Sep 17 00:00:00 2001 From: Nathan Cummins Date: Mon, 25 Aug 2025 11:18:39 +0930 Subject: [PATCH] Allow filtering of projects --- src/components/ProjectCard.astro | 14 ++++++- src/pages/projects.astro | 70 +++++++++++++++++++++++++++++++- 2 files changed, 80 insertions(+), 4 deletions(-) diff --git a/src/components/ProjectCard.astro b/src/components/ProjectCard.astro index 8930804..947ed22 100644 --- a/src/components/ProjectCard.astro +++ b/src/components/ProjectCard.astro @@ -14,9 +14,16 @@ interface Props { project: CollectionEntry<"projects">; textOn?: "left" | "right"; quality?: number; + class?: string; } -const { project, textOn = "left", quality = "80" } = Astro.props; +const { + project, + textOn = "left", + quality = "80", + class: className, + ...attrs +} = Astro.props; const images = getAllProjectImages(project); @@ -124,7 +131,10 @@ const projectHasBody = project.body && project.body.trim().length > 0; const link = `/projects/${slugify(project.data.type)}/${slugify(project.data.slug)}/`; --- -
+
b.data.date.valueOf() - a.data.date.valueOf() ); + +const types = [...new Set(projects.map((project) => project.data.type))]; --- @@ -16,6 +21,22 @@ const projects = (await getCollection("projects")).sort(
Recent Projects +
+ All + { + types.map((type) => ( + + {type} + + )) + } +
{ projects.map((project, index) => { @@ -23,6 +44,8 @@ const projects = (await getCollection("projects")).sort( ); }) @@ -32,3 +55,46 @@ const projects = (await getCollection("projects")).sort(
+ +