Bluewaterblog/blog/src/components/PostPreviewLarge.astro
2026-07-28 11:24:32 +02:00

80 lines
1.4 KiB
Text

---
import type { Post } from "../types/global";
import { findImageByPath } from "../lib/findImage";
import { Image } from "astro:assets";
interface Props {
post: Post;
url: string;
}
const { post, url } = Astro.props;
const img = findImageByPath(post.image.path);
---
<a href={url} class="no-link-link">
<div class="wide-container">
<div class="image-col col rounded">
<Image
src={img}
alt={post.image.alt}
layout="constrained"
/>
</div>
<div class="text-col col">
<div class="top-info">
<span>Autor: {post.author}</span>
<span>{post.date}</span>
</div>
<h2 class="headline">{post.title}</h2>
<h7 class="subtitle">{post.subtitle}</h7>
<p class="description">{post.description}</p>
</div>
</div>
</a>
<style>
.wide-container {
display: flex;
gap: 32px;
padding: 24px;
}
.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 {
display: flex;
justify-content: space-between;
margin-bottom: 16px;
}
</style>