diff options
| author | aman333nolawz <amananudhiu@gmail.com> | 2026-03-02 21:49:13 +0530 |
|---|---|---|
| committer | aman333nolawz <amananudhiu@gmail.com> | 2026-03-02 21:49:13 +0530 |
| commit | d41eff9eccf66644c4c60f53cb516bf079937a28 (patch) | |
| tree | 248a0863a3181369f943d678ec4273911d35efac /src/components/ProjectCard.astro | |
Using astro-erudite for static site generation
Diffstat (limited to 'src/components/ProjectCard.astro')
| -rw-r--r-- | src/components/ProjectCard.astro | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/components/ProjectCard.astro b/src/components/ProjectCard.astro new file mode 100644 index 0000000..03449a7 --- /dev/null +++ b/src/components/ProjectCard.astro @@ -0,0 +1,70 @@ +--- +import Link from '@/components/Link.astro' +import { Badge } from '@/components/ui/badge' +import { formatDate } from '@/lib/utils' +import { Icon } from 'astro-icon/components' +import { Image } from 'astro:assets' +import type { CollectionEntry } from 'astro:content' + +interface Props { + project: CollectionEntry<'projects'> +} + +const { project } = Astro.props +--- + +<div + class="hover:bg-muted/50 rounded-xl border p-4 transition-colors duration-300 ease-in-out" +> + <Link + href={project.data.link} + class="flex flex-col gap-4 sm:flex-row" + external + > + { + project.data.image && ( + <div class="w-full sm:max-w-3xs sm:shrink-0"> + <Image + src={project.data.image} + alt={project.data.name} + width={1200} + height={630} + class="object-cover" + /> + </div> + ) + } + <div class="grow"> + <h3 class="mb-1 text-lg font-medium"> + {project.data.name} + </h3> + <p class="text-muted-foreground mb-2 text-sm"> + {project.data.description} + </p> + { + project.data.startDate && ( + <p class="text-muted-foreground/70 mb-2 flex items-center gap-x-1.5 text-xs"> + <span class="flex items-center gap-x-1.5"> + <Icon name="lucide:calendar" class="size-3" /> + <span> + {formatDate(project.data.startDate)} + {project.data.endDate + ? ` → ${formatDate(project.data.endDate)}` + : ' → Present'} + </span> + </span> + </p> + ) + } + { + project.data.tags && ( + <div class="flex flex-wrap gap-2"> + {project.data.tags.map((tag: string) => ( + <Badge variant="muted">{tag}</Badge> + ))} + </div> + ) + } + </div> + </Link> +</div> |
