Automaten: Überschrift und Text in festen Zeilen statt zufälliger Umbrüche
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
---
|
||||
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
|
||||
@@ -11,6 +12,9 @@ interface Props {
|
||||
|
||||
const { label, title, lede, image, imageAlt = "" } = 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");
|
||||
---
|
||||
|
||||
<!--
|
||||
@@ -43,14 +47,18 @@ const dark = Boolean(image);
|
||||
<div class="relative mx-auto max-w-[84rem] px-[var(--gutter)] pt-36 pb-16 sm:pt-44 sm:pb-24">
|
||||
<span class:list={["reveal section-label", dark && "section-label-light"]}>{label}</span>
|
||||
<h1
|
||||
class:list={["reveal mt-6 max-w-[16ch]", dark ? "text-white" : "text-brand-ink"]}
|
||||
class:list={[
|
||||
"reveal mt-6",
|
||||
titleLines.length > 1 ? "max-w-full" : "max-w-[16ch]",
|
||||
dark ? "text-white" : "text-brand-ink",
|
||||
]}
|
||||
style="--delay: 0.08s"
|
||||
>
|
||||
{title}
|
||||
{titleLines.length > 1 ? titleLines.map((zeile) => <span class="block">{zeile}</span>) : title}
|
||||
</h1>
|
||||
{lede && (
|
||||
<p
|
||||
class:list={["reveal lede mt-7", dark ? "text-white/70" : "text-brand-text"]}
|
||||
class:list={["reveal lede mt-7 whitespace-pre-line", dark ? "text-white/70" : "text-brand-text"]}
|
||||
style="--delay: 0.16s"
|
||||
>
|
||||
{lede}
|
||||
|
||||
Reference in New Issue
Block a user