Stabilisiere den Website-Rahmen und veredele die zentralen Widgets.
Designiteration 1 auf Grundlage des Brand-UI-Kits (vorläufige Werte): - Kopfzeile mit konstanter Box und zwei Zuständen (großzügig, kompakt beim Scrollen) ohne Layoutsprung; Navigation bricht nie um, sondern verkürzt erst den Kontozugang und schaltet dann in den Menümodus. Scrollbalken-Reserve, gemeinsames Breitenmodell (Lesebereich, Standard, Breit, Vollbreite), Wortmarke und Inhalt fluchten. - Fokusfalle im Mobilmenü schließt auch den Weg von der Menü-Schaltfläche in den Inhalt. - Fußbereich mit Grundzeile für rechtliche Links und grünem Bogen. - Markenakzente (Unterstreichung, Strahlen, Bogen) als Komponenten. - Hero: Varianten Markenbühne (randlos) und Editorial, zweite Schaltfläche, Bildausschnitt. Bild und Text: Bildformat und Ausschnitt. Karten: hervorgehobene erste Karte, ganze Karte klickbar. Programmkarten mit Markentafel. Alles additiv, ohne neue Version. Testanpassungen: Die Website-Wortmarke trägt jetzt brand-lockup, die erste Hero-Schaltfläche button-brand (beabsichtigte Gestaltung). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3a5e5290f1
commit
33aaf64024
31 files changed
+1646
-357
No files matched your search
@@ -15,6 +15,7 @@
|
||||
* - Ein Abschnitt ohne darstellbares Widget entfällt samt Hintergrund und Trenner.
|
||||
* - Das erste dargestellte Widget der Seite ist der Seiteneinstieg (Überschrift erster Ordnung).
|
||||
* - Trenner stehen zwischen Abschnitten, nie nach dem letzten.
|
||||
* - Steht ein randloses Widget (WidgetType::bleeds) allein im Abschnitt, entfallen Innenabstand und Breitenbegrenzung.
|
||||
*/
|
||||
class SectionRenderer
|
||||
{
|
||||
@@ -43,7 +44,7 @@ public function renderAll(array $sections, RenderContext $context): HtmlString
|
||||
|
||||
if ($html !== '') {
|
||||
$first = false;
|
||||
$cells[] = ['units' => $slotUnits, 'html' => $html];
|
||||
$cells[] = ['units' => $slotUnits, 'html' => $html, 'bleeds' => $this->widgets->bleeds($widget)];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +70,7 @@ public function renderAll(array $sections, RenderContext $context): HtmlString
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $section
|
||||
* @param list<array{units: int, html: string}> $cells
|
||||
* @param list<array{units: int, html: string, bleeds: bool}> $cells
|
||||
*/
|
||||
private function renderSection(array $section, array $cells, int $index): string
|
||||
{
|
||||
@@ -105,6 +106,10 @@ private function renderSection(array $section, array $cells, int $index): string
|
||||
$classes[] = 'section-divider-space';
|
||||
}
|
||||
|
||||
if (count($cells) === 1 && $cells[0]['bleeds']) {
|
||||
$classes[] = 'section-bleed';
|
||||
}
|
||||
|
||||
$id = is_string($section['id'] ?? null) ? ' id="bereich-'.e($section['id']).'"' : '';
|
||||
$html = '<div class="'.e(implode(' ', $classes)).'"'.$id.'>';
|
||||
|
||||
|
||||
@@ -19,10 +19,10 @@ final class SectionStyle
|
||||
|
||||
/** @var array<string, string> */
|
||||
public const WIDTHS = [
|
||||
'narrow' => 'Schmal (Lesebreite)',
|
||||
'narrow' => 'Lesebereich',
|
||||
'standard' => 'Standard',
|
||||
'wide' => 'Breit',
|
||||
'full' => 'Volle Breite',
|
||||
'full' => 'Vollbreite',
|
||||
];
|
||||
|
||||
/** @var array<string, string> */
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Cms\Widgets\Support;
|
||||
|
||||
use App\Domain\Cms\Sections\SectionStyle;
|
||||
|
||||
/**
|
||||
* Bildausschnitt für Widget-Bilder: dieselben Fokuspunkte wie beim Abschnittshintergrund (SectionStyle::FOCUS).
|
||||
* Der Fokus bestimmt den Zuschnitt, wenn ein Bild in ein festes Seitenverhältnis gesetzt wird.
|
||||
*/
|
||||
final class ImageFocus
|
||||
{
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function options(): array
|
||||
{
|
||||
return SectionStyle::FOCUS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $settings
|
||||
*/
|
||||
public static function position(array $settings, string $key = 'focus'): string
|
||||
{
|
||||
$focus = $settings[$key] ?? 'center';
|
||||
|
||||
return SectionStyle::FOCUS_POSITIONS[is_string($focus) && isset(SectionStyle::FOCUS_POSITIONS[$focus]) ? $focus : 'center'];
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ public function label(): string
|
||||
|
||||
public function description(): string
|
||||
{
|
||||
return 'Mehrere Karten mit Titel, Text, Linkziel und optionalem Bild. Als Raster oder kompakte Liste.';
|
||||
return 'Mehrere Karten mit Titel, Text, Linkziel und optionalem Bild. Als Raster, kompakte Liste oder mit hervorgehobener erster Karte.';
|
||||
}
|
||||
|
||||
public function minUnits(): int
|
||||
@@ -49,7 +49,7 @@ public function stages(): array
|
||||
{
|
||||
return [
|
||||
'narrow' => 'eine Karte je Zeile',
|
||||
'wide' => 'so viele Karten nebeneinander, wie bei mindestens 14rem Kartenbreite passen',
|
||||
'wide' => 'so viele Karten nebeneinander, wie bei mindestens 15rem Kartenbreite passen; hervorgehobene Karte ab 44rem mit Bild neben dem Text',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -68,6 +68,7 @@ public function variants(): array
|
||||
return [
|
||||
'standard' => 'Raster',
|
||||
'compact' => 'Kompakte Liste',
|
||||
'featured' => 'Erste Karte hervorgehoben',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Domain\Cms\Widgets\Types;
|
||||
|
||||
use App\Domain\Cms\Widgets\RenderContext;
|
||||
use App\Domain\Cms\Widgets\Support\ImageFocus;
|
||||
use App\Domain\Cms\Widgets\Support\ImageRefFields;
|
||||
use App\Domain\Cms\Widgets\Support\PublicMedia;
|
||||
use App\Domain\Cms\Widgets\Support\SafeUrl;
|
||||
@@ -27,7 +28,7 @@ public function label(): string
|
||||
|
||||
public function description(): string
|
||||
{
|
||||
return 'Großer Seiteneinstieg mit Überschrift, Beschreibung, optionalem Bild und optionaler Schaltfläche.';
|
||||
return 'Großer Seiteneinstieg mit Überschrift, Beschreibung, optionalem Bild und bis zu zwei Schaltflächen. Als Markenbühne randlos über die volle Breite.';
|
||||
}
|
||||
|
||||
public function minUnits(): int
|
||||
@@ -43,8 +44,8 @@ public function preferredUnits(): int
|
||||
public function stages(): array
|
||||
{
|
||||
return [
|
||||
'narrow' => 'unter 48rem Slotbreite: Bild unter dem Text',
|
||||
'wide' => 'ab 48rem: Bild neben dem Text, größere Überschrift',
|
||||
'narrow' => 'unter 48rem Slotbreite: Bild über beziehungsweise unter dem Text',
|
||||
'wide' => 'ab 48rem: Bild neben dem Text, größere Überschrift; Markenbühne ab 56rem mit Text auf dem Bild',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -63,9 +64,32 @@ public function variants(): array
|
||||
return [
|
||||
'standard' => 'Standard (Bild neben dem Text)',
|
||||
'highlight' => 'Hervorgehoben (Markenfläche)',
|
||||
'stage' => 'Markenbühne (großes Bild, randlos)',
|
||||
'editorial' => 'Editorial (textbetont)',
|
||||
];
|
||||
}
|
||||
|
||||
public function settings(): array
|
||||
{
|
||||
return [
|
||||
'focus' => ImageFocus::options(),
|
||||
'text_side' => ['left' => 'Links', 'right' => 'Rechts'],
|
||||
];
|
||||
}
|
||||
|
||||
public function settingLabels(): array
|
||||
{
|
||||
return [
|
||||
'focus' => ['Bildausschnitt', 'Welcher Bildteil bei engen Zuschnitten sichtbar bleibt.'],
|
||||
'text_side' => ['Textseite (Markenbühne)', 'Auf welcher Seite der Text über dem Bild steht. Vorgabe: rechts.'],
|
||||
];
|
||||
}
|
||||
|
||||
public function bleeds(array $widget): bool
|
||||
{
|
||||
return ($widget['variant'] ?? null) === 'stage' && PublicMedia::isPublicPath($widget['refs']['image'] ?? null);
|
||||
}
|
||||
|
||||
public function dataRules(): array
|
||||
{
|
||||
return [
|
||||
@@ -73,6 +97,8 @@ public function dataRules(): array
|
||||
'text' => ['nullable', 'string', 'max:600'],
|
||||
'cta_label' => ['nullable', 'string', 'max:80', 'required_with:data.cta_url'],
|
||||
'cta_url' => ['nullable', 'string', 'max:500', 'required_with:data.cta_label'],
|
||||
'cta2_label' => ['nullable', 'string', 'max:80', 'required_with:data.cta2_url'],
|
||||
'cta2_url' => ['nullable', 'string', 'max:500', 'required_with:data.cta2_label'],
|
||||
'alt' => ['nullable', 'string', 'max:300'],
|
||||
];
|
||||
}
|
||||
@@ -95,6 +121,14 @@ public function dataFields(): array
|
||||
->rule(SafeUrl::rule())
|
||||
->requiredWith('cta_label'),
|
||||
]),
|
||||
Grid::make(2)->schema([
|
||||
TextInput::make('cta2_label')->label('Zweite Schaltfläche: Beschriftung (optional)')->maxLength(80),
|
||||
TextInput::make('cta2_url')
|
||||
->label('Zweite Schaltfläche: Linkziel')
|
||||
->maxLength(500)
|
||||
->rule(SafeUrl::rule())
|
||||
->requiredWith('cta2_label'),
|
||||
]),
|
||||
TextInput::make('alt')
|
||||
->label('Alternativtext des Bildes')
|
||||
->maxLength(300)
|
||||
@@ -109,10 +143,10 @@ public function refFields(): array
|
||||
|
||||
public function editorSchema(): array
|
||||
{
|
||||
[$heading, $text, $cta, $alt] = $this->dataFields();
|
||||
[$heading, $text, $cta, $cta2, $alt] = $this->dataFields();
|
||||
|
||||
return [
|
||||
Group::make([$heading, $text, $cta])->statePath('data'),
|
||||
Group::make([$heading, $text, $cta, $cta2])->statePath('data'),
|
||||
Group::make($this->refFields())->statePath('refs'),
|
||||
Group::make([$alt])->statePath('data'),
|
||||
];
|
||||
@@ -122,12 +156,14 @@ public function clean(array $data, array $refs, WidgetErrors $errors): array
|
||||
{
|
||||
$refs = ImageRefFields::clean($refs, $errors);
|
||||
|
||||
foreach (['text', 'cta_label', 'cta_url', 'alt'] as $key) {
|
||||
foreach (['text', 'cta_label', 'cta_url', 'cta2_label', 'cta2_url', 'alt'] as $key) {
|
||||
$data[$key] = filled($data[$key] ?? null) ? trim($data[$key]) : null;
|
||||
}
|
||||
|
||||
if ($data['cta_url'] !== null && ! SafeUrl::isSafe($data['cta_url'])) {
|
||||
$errors->add('data.cta_url', SafeUrl::message());
|
||||
foreach (['cta_url', 'cta2_url'] as $key) {
|
||||
if ($data[$key] !== null && ! SafeUrl::isSafe($data[$key])) {
|
||||
$errors->add("data.$key", SafeUrl::message());
|
||||
}
|
||||
}
|
||||
|
||||
if ($refs['image'] !== null && $data['alt'] === null) {
|
||||
@@ -140,11 +176,20 @@ public function clean(array $data, array $refs, WidgetErrors $errors): array
|
||||
public function resolve(array $widget, RenderContext $context): array
|
||||
{
|
||||
$data = $widget['data'];
|
||||
$hasAction = filled($data['cta_label'] ?? null) && SafeUrl::isSafe($data['cta_url'] ?? null);
|
||||
$actions = [];
|
||||
|
||||
foreach ([['cta_label', 'cta_url'], ['cta2_label', 'cta2_url']] as [$label, $url]) {
|
||||
if (filled($data[$label] ?? null) && SafeUrl::isSafe($data[$url] ?? null)) {
|
||||
$actions[] = ['label' => $data[$label], 'url' => $data[$url]];
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'imageUrl' => PublicMedia::imageUrl($widget['refs']),
|
||||
'action' => $hasAction ? ['label' => $data['cta_label'], 'url' => $data['cta_url']] : null,
|
||||
'action' => $actions[0] ?? null,
|
||||
'actions' => $actions,
|
||||
'focus' => ImageFocus::position($widget['settings'] ?? []),
|
||||
'textSide' => ($widget['settings']['text_side'] ?? null) === 'left' ? 'left' : 'right',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Domain\Cms\Widgets\Types;
|
||||
|
||||
use App\Domain\Cms\Widgets\RenderContext;
|
||||
use App\Domain\Cms\Widgets\Support\ImageFocus;
|
||||
use App\Domain\Cms\Widgets\Support\ImageRefFields;
|
||||
use App\Domain\Cms\Widgets\Support\PublicMedia;
|
||||
use App\Domain\Cms\Widgets\Support\RichText;
|
||||
@@ -49,7 +50,7 @@ public function stages(): array
|
||||
{
|
||||
return [
|
||||
'narrow' => 'unter 36rem Slotbreite: Bild über dem Text',
|
||||
'wide' => 'ab 36rem: Bild links oder rechts neben dem Text',
|
||||
'wide' => 'ab 36rem: Bild links oder rechts neben dem Text, gleich breit; ab 56rem Bild betont (7:5)',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -76,6 +77,22 @@ public function variants(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function settings(): array
|
||||
{
|
||||
return [
|
||||
'format' => ['landscape' => 'Querformat (4:3)', 'portrait' => 'Hochformat (4:5)', 'square' => 'Quadrat', 'original' => 'Originalformat'],
|
||||
'focus' => ImageFocus::options(),
|
||||
];
|
||||
}
|
||||
|
||||
public function settingLabels(): array
|
||||
{
|
||||
return [
|
||||
'format' => ['Bildformat', 'Zuschnitt des Bildes. Vorgabe: Querformat.'],
|
||||
'focus' => ['Bildausschnitt', 'Welcher Bildteil beim Zuschnitt sichtbar bleibt.'],
|
||||
];
|
||||
}
|
||||
|
||||
public function upgrade(array $widget, int $from): array
|
||||
{
|
||||
if ($from !== 1) {
|
||||
@@ -161,9 +178,13 @@ public function clean(array $data, array $refs, WidgetErrors $errors): array
|
||||
|
||||
public function resolve(array $widget, RenderContext $context): array
|
||||
{
|
||||
$format = $widget['settings']['format'] ?? 'landscape';
|
||||
|
||||
return [
|
||||
'imageUrl' => PublicMedia::imageUrl($widget['refs']),
|
||||
'body' => RichText::sanitize(is_string($widget['data']['body'] ?? null) ? $widget['data']['body'] : ''),
|
||||
'format' => in_array($format, ['landscape', 'portrait', 'square', 'original'], true) ? $format : 'landscape',
|
||||
'focus' => ImageFocus::position($widget['settings'] ?? []),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,16 @@ public function renderAll(?array $blocks, RenderContext $context): HtmlString
|
||||
return new HtmlString($html);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ob die Instanz randlos dargestellt werden darf (siehe WidgetType::bleeds).
|
||||
*
|
||||
* @param array<string, mixed> $widget aktuelle Hülle
|
||||
*/
|
||||
public function bleeds(array $widget): bool
|
||||
{
|
||||
return $this->registry->has((string) ($widget['type'] ?? '')) && $this->registry->get($widget['type'])->bleeds($widget);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rendert eine Instanz samt Abschnittshülle. Liefert '' wenn das Widget nichts darzustellen hat.
|
||||
*
|
||||
|
||||
@@ -102,6 +102,28 @@ public function settings(): array
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Bezeichnungen der Einstellungen im Editor: Schlüssel => [Bezeichnung, Hilfetext].
|
||||
* Ohne leere Auswahl gilt die Vorgabe der Darstellung.
|
||||
*
|
||||
* @return array<string, array{0: string, 1?: string}>
|
||||
*/
|
||||
public function settingLabels(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Ob die Instanz randlos über die volle Fensterbreite dargestellt wird, wenn sie allein in einem Abschnitt
|
||||
* mit Raster „4“ steht (zum Beispiel die Markenbühne). Der Abschnitt verzichtet dann auf Innenabstand und Begrenzung.
|
||||
*
|
||||
* @param array<string, mixed> $widget
|
||||
*/
|
||||
public function bleeds(array $widget): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prüfregeln für data. Schlüssel relativ zu data (zum Beispiel 'heading', 'items.*.title').
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user