summaryrefslogtreecommitdiff
path: root/src/components/BlogPosts.astro
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/BlogPosts.astro')
-rw-r--r--src/components/BlogPosts.astro21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/components/BlogPosts.astro b/src/components/BlogPosts.astro
index 48b94f0..87a75f4 100644
--- a/src/components/BlogPosts.astro
+++ b/src/components/BlogPosts.astro
@@ -1,6 +1,8 @@
---
import { getCollection } from 'astro:content';
import { Card, CardContent, CardDescription, CardHeader } from "@/components/ui/card";
+import { Badge } from "@/components/ui/badge";
+import PostHeader from "@/components/PostHeader.astro";
// Fetch all blog posts from the content collection
const posts = await getCollection('blog');
@@ -22,18 +24,13 @@ const dateFormatter = new Intl.DateTimeFormat('en-GB', {
<div class="space-y-4 max-h-96 overflow-y-auto">
{sortedPosts.map((post) => (
<a href={`/posts/${post.id}`} class="block hover:opacity-80 transition-opacity" data-astro-prefetch>
- <Card className="border rounded-xl">
- <CardHeader className="border-b">
- <h2 class="font-heading text-sm font-medium" transition:name={`post-title-${post.id}`}>{post.data.title}</h2>
- <CardDescription>{post.data.description}</CardDescription>
- </CardHeader>
- <CardContent>
- <div class="flex justify-between text-sm text-gray-500">
- <span>{dateFormatter.format(post.data.publishDate)}</span>
- <span>by {post.data.author}</span>
- </div>
- </CardContent>
- </Card>
+ <PostHeader
+ title={post.data.title}
+ slug={post.id}
+ description={post.data.description}
+ author={post.data.author}
+ publishDate={post.data.publishDate}
+ />
</a>
))}
</div>