Files
place4bees.com/frontend/src/components/SplitBand.astro
T
2026-09-17 16:02:51 +02:00

106 lines
3.3 KiB
Plaintext

---
interface Props {
eyebrow?: string;
title: string;
/** Optional; sonst füllt der Default-Slot die Textseite. */
text?: string;
cta?: { label: string; href: string };
image: string;
imageAlt: string;
/** Bild links statt rechts — Bänder werden abwechselnd gespiegelt. */
reverse?: boolean;
tone?: "cream" | "green" | "white" | "ink";
/** Blendet die Zahl links neben der Überschrift ein. */
index?: string;
/** object-position für Motive, die nicht mittig sitzen. */
imagePosition?: string;
eager?: boolean;
}
const {
eyebrow,
title,
text,
cta,
image,
imageAlt,
reverse = false,
tone = "cream",
index,
imagePosition = "center",
eager = false,
} = Astro.props;
const surfaces = {
cream: "bg-brand-surface",
green: "bg-[var(--color-brand-green-tint)]",
white: "bg-brand-surface-strong",
ink: "bg-brand-ink",
};
const dark = tone === "ink";
---
<!--
Randloses 50/50-Band: Textseite auf getönter Fläche, Foto füllt die andere
Hälfte bis zur Viewport-Kante. Abwechselnd gespiegelt — das ist der
Grundrhythmus von place4bees.com, den die zentrierten Container hier
vorher nicht abgebildet haben.
-->
<section class:list={["brand-section relative", surfaces[tone]]}>
<div class="grid lg:min-h-[34rem] lg:grid-cols-2">
<div
class:list={[
"flex items-center px-[var(--gutter)] py-[calc(var(--section-y)*0.8)]",
reverse ? "lg:order-2 lg:pl-[max(var(--gutter),4vw)] lg:pr-[8vw]" : "lg:pl-[8vw] lg:pr-[max(var(--gutter),4vw)]",
]}
>
<div class="reveal w-full max-w-[34rem]">
{index && (
<span
class="mb-6 block font-display text-[2.75rem] font-normal leading-none tabular-nums text-brand-primary"
aria-hidden="true"
>
{index}
</span>
)}
{eyebrow && (
<span class:list={["section-label", dark && "section-label-light"]}>{eyebrow}</span>
)}
<h2 class:list={["mt-5 max-w-[16ch]", dark && "text-white"]}>{title}</h2>
{text && (
<p class:list={["mt-6 max-w-[52ch] leading-relaxed", dark ? "text-white/65" : "text-brand-text"]}>
{text}
</p>
)}
<slot />
{cta && (
<a href={cta.href} class:list={["link-underline mt-8", dark && "text-white"]}>
{cta.label}
<svg viewBox="0 0 20 20" class="h-4 w-4 text-brand-primary" fill="none" stroke="currentColor" stroke-width="1.75" aria-hidden="true">
<path d="M4 10h12M11 5l5 5-5 5" stroke-linecap="round" stroke-linejoin="round" />
</svg>
</a>
)}
</div>
</div>
<div class:list={["band-media relative overflow-hidden min-h-[16rem] sm:min-h-[22rem]", reverse && "lg:order-1"]}>
<img
src={image}
alt={imageAlt}
loading={eager ? "eager" : "lazy"}
class="reveal reveal-clip scroll-zoom absolute inset-0 h-full w-full object-cover"
style={`--delay: 0.08s; object-position: ${imagePosition};`}
/>
</div>
</div>
</section>
<style>
/* Die Spalte hat overflow:hidden und wäre damit selbst Scroll-Container.
* Die benannte Timeline liegt deshalb hier und wird vom Bild referenziert. */
.band-media {
view-timeline-name: --media-view;
}
</style>