Bluewaterblog/blog/src/components/PostPreviewSmall.astro
2026-08-29 10:41:02 +02:00

49 lines
1.1 KiB
Text

---
import type { PostData } from "../content.config";
import { findImageByPath } from "../lib/findImage";
import { formatLocalizedDateString } from "../lib/formatDate";
interface Props {
post: PostData;
}
const { post } = Astro.props;
const img = findImageByPath(post.image.path)
const localeDate = formatLocalizedDateString(post.date)
---
<a href={`/blog/${post.slug}`} class="no-link-link">
<div class="frame rounded">
<img src={img.src} alt={post.image.alt} class="rounded" />
<h2 class="headline">{post.title}</h2>
<h7 class="subtitle">{post.subtitle}</h7>
<p class="description">{post.description}</p>
<div class="bottom-info">
<span>Author: {post.author}</span>
<span>{localeDate}</span>
</div>
</div>
</a>
<style>
.frame {
flex: 220px; auto 0 0;
padding: 8px;
display: flex;
flex-direction: column;
border: 1px solid black;
width: 240px;
height: 100%;
}
img {
max-height: 220px;
}
.bottom-info {
display: flex;
justify-content: space-between;
margin-top: auto;
}
</style>