Bluewaterblog/blog/src/components/PostPreviewSmall.astro
2026-10-05 15:09:45 +02:00

65 lines
1.3 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" />
<div id="info">
<span>{localeDate}</span>
<span> | </span>
<span>Author: {post.author}</span>
<span> | </span>
<span>Lesezeit: {post.time2read} min</span>
</div>
<h1 class="headline">{post.title}</h1>
<h2 class="subtitle">{post.subtitle}</h2>
<p class="description">{post.description}</p>
</div>
<style>
.frame {
display: flex;
flex-direction: column;
height: 100%;
}
img {
height: 200px;
object-fit: cover;
object-position: center;
}
#info {
padding: 8px 0 0 0;
font-size: 1.2rem;
* {
color: grey;
}
}
.headline,
.subtitle {
color: var(--primary-color);
font-weight: bold;
margin: 8px 0 0 0;
}
p {
font-size: 1.2rem;
line-height: 1.4;
margin: 8px 0 0 0;
}
</style>
</a>