Bluewaterblog/blog/src/components/PostPreviewLarge.astro
2026-09-10 09:05:22 +02:00

106 lines
2 KiB
Text

---
import { findImageByPath } from "../lib/findImage";
import { Image } from "astro:assets";
import { formatLocalizedDateString } from "../lib/formatDate";
import type { PostData } from "../content.config";
interface Props {
post: PostData;
}
const { post } = Astro.props;
const img = findImageByPath(post.image.path);
const localeDate = formatLocalizedDateString(post.date)
---
<div class="wide-container">
<div class="image-col col rounded">
<a href={`/blog/${post.slug}`}>
<Image src={img} alt={post.image.alt} layout="constrained" />
</a>
</div>
<div class="text-col col">
<a href={`/blog/${post.slug}`} class="headline-link">
<h2 class="headline">{post.title}</h2>
</a>
<h7>{post.subtitle}</h7>
<div class="top-info">
<span>{localeDate}</span>
<span class="vertical-line"></span>
<span>Autor: {post.author}</span>
<span class="vertical-line"></span>
<span>Lesezeit: {post.time2read} min</span>
</div>
<p class="description">{post.description}</p>
</div>
</div>
<style>
.wide-container {
display: flex;
gap: 32px;
padding: 0 32px;
min-width: 80%;
}
.col {
width: 50%;
box-sizing: border-box;
min-width: 0;
min-height: 0;
}
.text-col {
flex-direction: column;
justify-content: flex-start;
margin: 32px 0;
}
h2 {
margin: 0;
}
.image-col {
position: relative;
overflow: hidden;
}
.image-col img {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: cover;
object-position: center;
}
.top-info {
justify-content: space-between;
margin: 16px 0;
font-size: 1.125rem;
color: lightslategray;
}
.vertical-line {
color: #789;
border-right-width: 2px;
margin-right: 16px;
}
@media only screen and (max-width: 800px) {
.wide-container {
flex-direction: column;
gap: 0;
min-width: auto;
}
.col {
width: 100%;
}
.image-col img {
position: static;
}
}
</style>