The minimalistic document archiving platform.
---
import { Image } from 'astro:assets';
import { formatDate } from '../../../utils/dates';
import { resolveImage } from '../../../utils/urls';
export type Props = {
post: {
id: string;
data: {
title: string;
description: string;
publishedAt: Date;
coverImage?: string;
};
};
};
const { post } = Astro.props;
const coverImage = await resolveImage(post.data.coverImage);
---
<article
class="relative border max-w-700px mx-auto bg-card rounded-xl transition hover:border-primary overflow-hidden"
aria-labelledby={post.id}
>
{coverImage && (
<Image
src={coverImage}
alt={post.data.title}
height={(630 * 700) / 1500}
width={700}
class="border-b"
/>
)}
<div class="p-6">
<h3 class="font-medium text-2xl" id={post.id}>
<a
href={`/blog/${post.id}/`}
data-astro-prefetch
class="outline-none after:absolute after:inset-0 after:content-['']"
>
{post.data.title}
</a>
</h3>
<p class="text-muted-foreground my-2">{post.data.description}</p>
<time class="text-muted-foreground block" datetime={post.data.publishedAt.toISOString()}>
{formatDate(post.data.publishedAt, { locale: Astro.currentLocale })}
</time>
</div>
</article>