summaryrefslogtreecommitdiff
path: root/src/components/BlogPostCard.astro
diff options
context:
space:
mode:
authorIwanIDev <iwan@iwani.dev>2026-03-27 16:14:29 +0000
committerIwanIDev <iwan@iwani.dev>2026-03-27 16:14:29 +0000
commite88144ab670e7585f998ce9d54236d5cc77d6bd4 (patch)
tree77d02f3ce9c056f41ddedc5ddb3a660ae9ffce81 /src/components/BlogPostCard.astro
parent688a35816ed9002a304d71e0a9fa8545323c3e72 (diff)
refactor: made the home page blog post cards and the blog post card header more consistent
They are now the same component. I've renamed the component from PostHeader to BlogPostCard, which is more accurate now.
Diffstat (limited to 'src/components/BlogPostCard.astro')
-rw-r--r--src/components/BlogPostCard.astro34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/components/BlogPostCard.astro b/src/components/BlogPostCard.astro
new file mode 100644
index 0000000..875ddca
--- /dev/null
+++ b/src/components/BlogPostCard.astro
@@ -0,0 +1,34 @@
+---
+import { Card, CardContent, CardDescription, CardHeader, CardFooter } from "@/components/ui/card";
+import { Badge } from "@/components/ui/badge";
+import { Separator } from "@/components/ui/separator";
+
+interface Props {
+ title: string;
+ slug: string;
+ description: string;
+ author: string;
+ publishDate: Date;
+}
+
+const { title, slug, description, author, publishDate } = Astro.props as Props;
+
+const dateFormatter = new Intl.DateTimeFormat('en-GB', {
+ day: '2-digit',
+ month: 'long',
+ year: 'numeric',
+});
+---
+
+<Card className="border rounded-none">
+ <CardHeader className="border-b">
+ <h2 class="font-heading text-sm font-medium" transition:name={`post-title-${slug}`}>{title}</h2>
+ <CardDescription>{description}</CardDescription>
+ </CardHeader>
+ <CardContent>
+ <div class="flex flex-wrap gap-2">
+ <Badge variant="secondary">{author}</Badge>
+ <Badge variant="outline">{dateFormatter.format(publishDate)}</Badge>
+ </div>
+ </CardContent>
+</Card>