Files
place4bees.com/frontend/src/components/PageHero.astro
T
2026-11-11 14:59:14 +01:00

87 lines
2.5 KiB
Plaintext

---
interface Props {
label: string;
/** Ein Zeilenumbruch ("\n") setzt eine feste Zeile, z. B. bei zwei Sätzen. */
title: string;
lede?: string;
/** Optional photo used as a full-bleed backdrop instead of the textured
* cream ground. */
image?: string;
imageAlt?: string;
/** Optionales Foto rechts neben dem Text, auf hellem Grund (ab lg). */
sideImage?: string;
sideImageAlt?: string;
}
const { label, title, lede, image, imageAlt = "", sideImage, sideImageAlt = "" } = Astro.props;
const dark = Boolean(image);
// Mit festen Zeilen bestimmt der Text die Breite, nicht die 16ch-Grenze —
// sonst bricht jede Zeile noch einmal mittendrin um.
const titleLines = title.split("\n");
---
<!--
Shared page header. Subpages previously opened directly on a section
heading, which made every one of them start at the same visual altitude as
its own body copy. This gives each page one clear entry point.
-->
<section
class:list={[
"brand-section relative overflow-hidden",
dark ? "bg-brand-ink" : "honeycomb-bg",
]}
>
{image ? (
<img
src={image}
alt={imageAlt}
class="absolute inset-0 h-full w-full object-cover opacity-45"
aria-hidden={imageAlt === "" ? "true" : undefined}
/>
) : null}
{image ? (
<div
class="absolute inset-0 bg-gradient-to-r from-brand-ink via-brand-ink/80 to-brand-ink/40"
aria-hidden="true"
>
</div>
) : null}
<div
class:list={[
"relative mx-auto max-w-[84rem] px-[var(--gutter)] pt-36 pb-16 sm:pt-44 sm:pb-24",
sideImage && "grid items-center gap-12 lg:grid-cols-[1.2fr_1fr]",
]}
>
<div>
<span class:list={["reveal section-label", dark && "section-label-light"]}>{label}</span>
<h1
class:list={[
"reveal mt-6",
titleLines.length > 1 ? "max-w-full" : "max-w-[16ch]",
dark ? "text-white" : "text-brand-ink",
]}
style="--delay: 0.08s"
>
{titleLines.length > 1 ? titleLines.map((zeile) => <span class="block">{zeile}</span>) : title}
</h1>
{lede && (
<p
class:list={["reveal lede mt-7 whitespace-pre-line", dark ? "text-white/70" : "text-brand-text"]}
style="--delay: 0.16s"
>
{lede}
</p>
)}
</div>
{sideImage && (
<img
src={sideImage}
alt={sideImageAlt}
class="reveal aspect-[4/5] w-full max-w-[26rem] justify-self-center rounded-[var(--radius-inner)] object-cover shadow-md lg:justify-self-end"
style="--delay: 0.2s"
/>
)}
</div>
</section>