Merge pull request 'Minigrafiken im CMS' (#8) from develop into main
Reviewed-on: #8
This commit was merged in pull request #8.
This commit is contained in:
commit
0e45dae0af
23 files changed
+541
-15
No files matched your search
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Cms\Widgets\Support;
|
||||
|
||||
/**
|
||||
* Zulässige Kleingrafiken des Brand-Kits als Auswahl im CMS (ADR-30: nur feste Werte, nie freie Dateinamen).
|
||||
*
|
||||
* Die Schlüssel sind Dateinamen aus resources/svg/brand/symbole/. Nicht angeboten werden die gelbe Unterstreichung
|
||||
* (eigene Einstellung „Pinselstrich“) und die Signalstrahlen (Markenakzent des Einstiegs). Eine Prüfung im Test stellt
|
||||
* sicher, dass jeder Schlüssel eine vorhandene Datei hat.
|
||||
*/
|
||||
final class HeadingAccent
|
||||
{
|
||||
/** @var array<string, string> */
|
||||
public const SYMBOLS = [
|
||||
'bildung' => 'Bildung',
|
||||
'buch' => 'Buch',
|
||||
'download' => 'Download',
|
||||
'filmklappe' => 'Filmklappe',
|
||||
'filmstreifen' => 'Filmstreifen',
|
||||
'gruppe' => 'Gruppe',
|
||||
'merkblatt' => 'Merkblatt',
|
||||
'muskelarm' => 'Starker Arm',
|
||||
'paket' => 'Paket',
|
||||
'pause-hand' => 'Pause (Hand)',
|
||||
'play' => 'Abspielen',
|
||||
'schutzschild' => 'Schutzschild',
|
||||
'sprechblase-fragezeichen' => 'Frage (Sprechblase)',
|
||||
'uebungsblatt' => 'Übungsblatt',
|
||||
];
|
||||
|
||||
/** @var array<string, string> */
|
||||
public const BRUSH = ['brush' => 'Gelber Pinselstrich unter der Überschrift'];
|
||||
|
||||
public const SYMBOL_LABEL = ['Symbol vor der Überschrift', 'Kleine Grafik aus dem Brand-Kit vor dem Text. Sie ist reine Zierde und wird von Hilfstechnik nicht vorgelesen. Vorgabe: kein Symbol.'];
|
||||
|
||||
public const BRUSH_LABEL = ['Pinselstrich', 'Gelbe Unterstreichung unter der Überschrift (freigegebenes Motiv aus dem Brand-Kit). Vorgabe: ohne.'];
|
||||
|
||||
/**
|
||||
* Gültiger Symbolname aus den Einstellungen eines Widgets oder null.
|
||||
*
|
||||
* @param array<string, mixed> $settings
|
||||
*/
|
||||
public static function symbol(array $settings): ?string
|
||||
{
|
||||
$name = $settings['symbol'] ?? null;
|
||||
|
||||
return is_string($name) && array_key_exists($name, self::SYMBOLS) ? $name : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $settings
|
||||
*/
|
||||
public static function hasBrush(array $settings): bool
|
||||
{
|
||||
return ($settings['accent'] ?? null) === 'brush';
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Domain\Cms\Widgets\Types;
|
||||
|
||||
use App\Domain\Cms\Widgets\Support\HeadingAccent;
|
||||
use App\Domain\Cms\Widgets\Support\SafeUrl;
|
||||
use App\Domain\Cms\Widgets\WidgetErrors;
|
||||
use App\Domain\Cms\Widgets\WidgetType;
|
||||
@@ -90,6 +91,21 @@ public function dataFields(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function settings(): array
|
||||
{
|
||||
return ['symbol' => HeadingAccent::SYMBOLS];
|
||||
}
|
||||
|
||||
public function settingGroups(): array
|
||||
{
|
||||
return ['Aussehen' => ['symbol']];
|
||||
}
|
||||
|
||||
public function settingLabels(): array
|
||||
{
|
||||
return ['symbol' => HeadingAccent::SYMBOL_LABEL];
|
||||
}
|
||||
|
||||
public function clean(array $data, array $refs, WidgetErrors $errors): array
|
||||
{
|
||||
if (! SafeUrl::isSafe($data['url'] ?? null)) {
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Cms\Widgets\Types;
|
||||
|
||||
use App\Domain\Cms\Widgets\RenderContext;
|
||||
use App\Domain\Cms\Widgets\Support\HeadingAccent;
|
||||
use App\Domain\Cms\Widgets\WidgetErrors;
|
||||
use App\Domain\Cms\Widgets\WidgetType;
|
||||
use Filament\Forms\Components\Repeater;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
/**
|
||||
* Merkmalszeile nach den Entwürfen des Brand-Kits (04_visuelle_entwuerfe): zwei bis vier Merkmale nebeneinander,
|
||||
* je mit Symbol, Kurztitel und einem Satz. Die Anzahl der Einträge bestimmt die Spaltenzahl; es gibt keine
|
||||
* zweite Einstellung dafür. Das Symbol stammt aus der festen Auswahl (HeadingAccent::SYMBOLS), nie aus einem
|
||||
* freien Dateinamen.
|
||||
*/
|
||||
class FeaturesWidget extends WidgetType
|
||||
{
|
||||
public function key(): string
|
||||
{
|
||||
return 'features';
|
||||
}
|
||||
|
||||
public function label(): string
|
||||
{
|
||||
return 'Merkmalszeile';
|
||||
}
|
||||
|
||||
public function description(): string
|
||||
{
|
||||
return 'Zwei bis vier Merkmale nebeneinander, je mit Symbol, Kurztitel und einem Satz.';
|
||||
}
|
||||
|
||||
public function supportedUnits(): array
|
||||
{
|
||||
return [2, 3, 4];
|
||||
}
|
||||
|
||||
public function narrowBehavior(): string
|
||||
{
|
||||
return 'Die Merkmale stehen nebeneinander, solange jedes mindestens 12 rem breit bleibt; darunter stehen sie untereinander.';
|
||||
}
|
||||
|
||||
public function preferredUnits(): int
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public function stages(): array
|
||||
{
|
||||
return [
|
||||
'narrow' => 'ein Merkmal je Zeile',
|
||||
'wide' => 'so viele Merkmale nebeneinander, wie bei mindestens 12rem Breite passen',
|
||||
];
|
||||
}
|
||||
|
||||
public function icon(): string
|
||||
{
|
||||
return 'heroicon-o-sparkles';
|
||||
}
|
||||
|
||||
public function schematic(): array
|
||||
{
|
||||
return [[3, 6, 14, 14, 'accent'], [23, 6, 14, 14, 'accent'], [43, 6, 14, 14, 'accent'], [3, 24, 14, 3, 'ink'], [23, 24, 14, 3, 'ink'], [43, 24, 14, 3, 'ink'], [3, 29, 14, 2, 'line'], [23, 29, 14, 2, 'line'], [43, 29, 14, 2, 'line']];
|
||||
}
|
||||
|
||||
public function dataRules(): array
|
||||
{
|
||||
return [
|
||||
'items' => ['required', 'array', 'min:2', 'max:4'],
|
||||
'items.*.symbol' => ['required', 'string', Rule::in(array_keys(HeadingAccent::SYMBOLS))],
|
||||
'items.*.title' => ['required', 'string', 'max:60'],
|
||||
'items.*.text' => ['nullable', 'string', 'max:200'],
|
||||
];
|
||||
}
|
||||
|
||||
public function dataFields(): array
|
||||
{
|
||||
return [
|
||||
Repeater::make('items')
|
||||
->label('Merkmale')
|
||||
->schema([
|
||||
Select::make('symbol')->label('Symbol')->options(HeadingAccent::SYMBOLS)->required(),
|
||||
TextInput::make('title')->label('Kurztitel')->required()->maxLength(60),
|
||||
Textarea::make('text')->label('Satz')->rows(2)->maxLength(200),
|
||||
])
|
||||
->minItems(2)
|
||||
->maxItems(4)
|
||||
->reorderableWithButtons()
|
||||
->collapsible()
|
||||
->itemLabel(fn (array $state): ?string => $state['title'] ?? null)
|
||||
->addActionLabel('Merkmal hinzufügen')
|
||||
->helperText('Die Anzahl der Merkmale bestimmt die Spalten: zwei, drei oder vier.'),
|
||||
];
|
||||
}
|
||||
|
||||
public function clean(array $data, array $refs, WidgetErrors $errors): array
|
||||
{
|
||||
foreach ($data['items'] as $index => $item) {
|
||||
$data['items'][$index] = [
|
||||
'symbol' => $item['symbol'],
|
||||
'title' => $item['title'],
|
||||
'text' => filled($item['text'] ?? null) ? $item['text'] : null,
|
||||
];
|
||||
}
|
||||
|
||||
return [$data, $refs];
|
||||
}
|
||||
|
||||
public function resolve(array $widget, RenderContext $context): array
|
||||
{
|
||||
$items = [];
|
||||
|
||||
foreach ($widget['data']['items'] ?? [] as $item) {
|
||||
if (! is_array($item) || ! filled($item['title'] ?? null)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$items[] = [
|
||||
'symbol' => HeadingAccent::symbol(['symbol' => $item['symbol'] ?? null]),
|
||||
'title' => $item['title'],
|
||||
'text' => $item['text'] ?? null,
|
||||
];
|
||||
}
|
||||
|
||||
return ['items' => $items];
|
||||
}
|
||||
|
||||
public function summary(array $widget): string
|
||||
{
|
||||
$titles = array_filter(array_map(fn ($item) => is_array($item) ? ($item['title'] ?? null) : null, $widget['data']['items'] ?? []));
|
||||
|
||||
return count($titles).' Merkmale: '.implode(', ', $titles);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Domain\Cms\Widgets\Types;
|
||||
|
||||
use App\Domain\Cms\Widgets\Support\HeadingAccent;
|
||||
use App\Domain\Cms\Widgets\WidgetType;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
@@ -71,6 +72,27 @@ public function dataFields(): array
|
||||
];
|
||||
}
|
||||
|
||||
public function settings(): array
|
||||
{
|
||||
return [
|
||||
'symbol' => HeadingAccent::SYMBOLS,
|
||||
'accent' => HeadingAccent::BRUSH,
|
||||
];
|
||||
}
|
||||
|
||||
public function settingGroups(): array
|
||||
{
|
||||
return ['Aussehen' => ['symbol', 'accent']];
|
||||
}
|
||||
|
||||
public function settingLabels(): array
|
||||
{
|
||||
return [
|
||||
'symbol' => HeadingAccent::SYMBOL_LABEL,
|
||||
'accent' => HeadingAccent::BRUSH_LABEL,
|
||||
];
|
||||
}
|
||||
|
||||
public function summary(array $widget): string
|
||||
{
|
||||
return (string) ($widget['data']['heading'] ?? '');
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Domain\Cms\Widgets\Types;
|
||||
|
||||
use App\Domain\Cms\Widgets\RenderContext;
|
||||
use App\Domain\Cms\Widgets\Support\HeadingAccent;
|
||||
use App\Domain\Cms\Widgets\Support\HeroVideo;
|
||||
use App\Domain\Cms\Widgets\Support\ImageRefFields;
|
||||
use App\Domain\Cms\Widgets\Support\PremiumFields;
|
||||
@@ -112,13 +113,14 @@ public function settings(): array
|
||||
return [
|
||||
'heading_level' => PremiumFields::HEADING_LEVELS,
|
||||
'accent' => ['underline' => 'Gelbe Unterstreichung', 'rays' => 'Unterstreichung und Signalstrahlen', 'none' => 'Ohne Akzent'],
|
||||
'symbol' => HeadingAccent::SYMBOLS,
|
||||
];
|
||||
}
|
||||
|
||||
public function settingGroups(): array
|
||||
{
|
||||
return [
|
||||
'Aussehen' => ['accent'],
|
||||
'Aussehen' => ['accent', 'symbol'],
|
||||
'Seitenstruktur' => ['heading_level'],
|
||||
];
|
||||
}
|
||||
@@ -128,6 +130,7 @@ public function settingLabels(): array
|
||||
return [
|
||||
'heading_level' => ['Überschriftenebene', 'Betrifft nur die Gliederung für Suchmaschinen und Hilfstechnik, nicht das Aussehen. Der erste Einstieg einer Seite ist immer die Hauptüberschrift (H1).'],
|
||||
'accent' => ['Markenakzent', 'Freigegebene Akzente aus dem Brand-UI-Kit. Vorgabe: gelbe Unterstreichung.'],
|
||||
'symbol' => HeadingAccent::SYMBOL_LABEL,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Domain\Cms\Widgets\Types;
|
||||
|
||||
use App\Domain\Cms\Widgets\RenderContext;
|
||||
use App\Domain\Cms\Widgets\Support\HeadingAccent;
|
||||
use App\Domain\Cms\Widgets\Support\ImageRefFields;
|
||||
use App\Domain\Cms\Widgets\Support\PremiumFields;
|
||||
use App\Domain\Cms\Widgets\Support\PublicMedia;
|
||||
@@ -114,13 +115,14 @@ public function settings(): array
|
||||
return [
|
||||
'surface' => ['cream' => 'Creme (Markenfläche)', 'clear' => 'Ohne eigene Fläche', 'navy' => 'Navy (dunkel)'],
|
||||
'heading_level' => PremiumFields::HEADING_LEVELS,
|
||||
'symbol' => HeadingAccent::SYMBOLS,
|
||||
];
|
||||
}
|
||||
|
||||
public function settingGroups(): array
|
||||
{
|
||||
return [
|
||||
'Aussehen' => ['surface'],
|
||||
'Aussehen' => ['surface', 'symbol'],
|
||||
'Seitenstruktur' => ['heading_level'],
|
||||
];
|
||||
}
|
||||
@@ -129,6 +131,7 @@ public function settingLabels(): array
|
||||
{
|
||||
return [
|
||||
'surface' => ['Hintergrund des Widgets', 'Unabhängig vom Abschnittshintergrund. „Ohne eigene Fläche“ übernimmt den Abschnitt.'],
|
||||
'symbol' => HeadingAccent::SYMBOL_LABEL,
|
||||
'heading_level' => ['Überschriftenebene', 'Betrifft nur die Gliederung für Suchmaschinen und Hilfstechnik, nicht das Aussehen. Steht das Widget als erstes auf der Seite, ist die Überschrift immer H1.'],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
use App\Domain\Cms\Widgets\Types\CardsWidget;
|
||||
use App\Domain\Cms\Widgets\Types\CatalogCardsWidget;
|
||||
use App\Domain\Cms\Widgets\Types\FaqWidget;
|
||||
use App\Domain\Cms\Widgets\Types\FeaturesWidget;
|
||||
use App\Domain\Cms\Widgets\Types\HeadingWidget;
|
||||
use App\Domain\Cms\Widgets\Types\HeroWidget;
|
||||
use App\Domain\Cms\Widgets\Types\ImageTextWidget;
|
||||
@@ -26,6 +27,7 @@
|
||||
ProseWidget::class,
|
||||
ImageTextWidget::class,
|
||||
CardsWidget::class,
|
||||
FeaturesWidget::class,
|
||||
CatalogCardsWidget::class,
|
||||
TopicCardWidget::class,
|
||||
MediaCardWidget::class,
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 122 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 110 KiB |
@@ -36,6 +36,18 @@ ## 1a. Stand der Umsetzung Stufe 1 und 2 (Branch `feature/kleingrafiken-symbole-
|
||||
- **Mitgliederbereich unverändert.** Das freigegebene Design (Kit 14) hat eigene Art-Marken (grüne Großbuchstaben mit Linien-Symbol, `x-member.type`). Die pastellfarbenen Tags würden davon abweichen; ob sie dort gewollt sind, ist deine Entscheidung.
|
||||
- **Katalogkarten (Programm/Modul) ohne Tag.** Es gibt keinen eindeutigen Schlüssel, und „Paket“ meint möglicherweise das Angebotspaket (Bundle) statt des Programms. „Film + Übungen“ und „Film + Merkblatt“ werden ebenfalls nicht automatisch vergeben. Die Komponente kann alle sechs Tags darstellen.
|
||||
|
||||
## 1b. Stand der Umsetzung Stufe 3: Gestaltung im Redaktionsinhalt (Branch `feature/cms-symbole-merkmale`)
|
||||
|
||||
Die Tags auf den Medienkarten sind nur ein Nebenschauplatz. Der eigentliche Nutzen liegt im Text, deshalb gibt es jetzt:
|
||||
|
||||
- **Symbol vor der Überschrift** als Einstellung „Symbol vor der Überschrift“ (`settings.symbol`) an den Widgets Überschrift und Einleitung, Einstieg, Bild und Text und Handlungsaufruf. Auswahl: 14 Kleingrafiken (alle Symbole außer gelber Unterstreichung und Signalstrahlen), Vorgabe keines. Es sind nur feste Werte zulässig (ADR-30); ein unbekannter Name wird beim Speichern abgewiesen.
|
||||
- **Pinselstrich** (`settings.accent` = `brush`) unter der Überschrift des Widgets Überschrift und Einleitung, mit dem freigegebenen Motiv „gelbe-unterstreichung“.
|
||||
- **Merkmalszeile** (neues Widget `features`): zwei bis vier Merkmale mit Symbol, Kurztitel und einem Satz. Die Anzahl der Einträge bestimmt die Spalten; bei wenig Platz stehen sie untereinander.
|
||||
- **Dunkle Flächen:** Die Symbole haben feste Markenfarben mit viel Marineblau. Auf `scope-dark`, `scope-accent`, dem Navy-Bild-und-Text und dem Navy-Einstieg stehen sie deshalb auf einer weißen Scheibe.
|
||||
- **Beleg:** `16_Lara-Felix-Kleingrafiken/abnahme/cms-symbole-merkmale-breit.png` und `…-schmal.png` (lokal aus den echten Ansichten und dem gebauten Stylesheet gerendert). Die Prüfung im Editor und auf luf-test steht noch aus.
|
||||
|
||||
Nicht umgesetzt: Symbole mitten im Fließtext (Stufe 3b, braucht einen Symbol-Knopf im Editor) und die Lernbausteine im Player (Stufe 4).
|
||||
|
||||
## 2. Bestandsaufnahme der 32 Motive
|
||||
|
||||
Technische Prüfung der SVG-Dateien (belegt durch Auswertung der Dateien, nicht nur Sichtprüfung):
|
||||
|
||||
@@ -75,6 +75,7 @@ ## 4. Registrierte Widget-Arten
|
||||
| `prose` | Fließtext | 1 | `standard` | 1–4 | – | – |
|
||||
| `image_text` | Bild und Text, Premium nach Kit v1.6 | 3 | `image_left`, `image_right` (Bildseite) | 1–4 | `compact` (Kompakt), `normal` (Standard, Vorgabe), `spacious` (Großzügig) | `refs.image` |
|
||||
| `cards` | Redaktionelle Karten | 1 | `standard` (Raster), `compact` (Liste), `featured` (erste Karte hervorgehoben) | 1–4 | – | Bild je Karte in `data.items[].image` |
|
||||
| `features` | Merkmalszeile (2–4 Merkmale mit Symbol, Kurztitel, Satz) | 1 | `standard` | 2–4 | – | – |
|
||||
| `catalog_cards` | Programm- und Modulkarten | 1 | `standard`, `compact` | 1–4 | – | `refs.items[] = {type: composition, id}` |
|
||||
| `topic_card` | Themenkarte, Premium-Karte nach Kit v1.7 | 1 | `adaptive`, `stacked` | 1–4 | `auto` (Vorgabe), `fill` | `refs.pillar`, `refs.image` |
|
||||
| `media_card` | Medien- und Materialkarte, Kit v1.7 | 1 | `adaptive`, `stacked` | 1–4 | `auto` (Vorgabe), `fill` | `refs.element`, `refs.image` |
|
||||
@@ -97,6 +98,10 @@ ## 4. Registrierte Widget-Arten
|
||||
| Überschriftenebene | `settings.heading_level` | `auto` (Vorgabe), `h2`, `h3`; das erste Widget der Seite ist immer H1 |
|
||||
| Akzent (Einstieg) | `settings.accent` | `underline` (Vorgabe), `rays`, `none` |
|
||||
| Fläche (Bild und Text) | `settings.surface` | `cream` (Vorgabe), `clear` (übernimmt den Abschnitt), `navy` |
|
||||
| Symbol vor der Überschrift | `settings.symbol` | Einstieg, Überschrift, Bild und Text, Handlungsaufruf. Feste Auswahl `App\Domain\Cms\Widgets\Support\HeadingAccent::SYMBOLS` (14 Kleingrafiken des Brand-Kits), Vorgabe keines. Zierde (`aria-hidden`); auf dunklen Flächen steht das Symbol auf einer weißen Scheibe |
|
||||
| Pinselstrich (Überschrift) | `settings.accent` = `brush` | nur Widget „Überschrift und Einleitung“; Motiv „gelbe-unterstreichung“ des Kits |
|
||||
|
||||
**Merkmalszeile.** `data.items[]` mit `symbol` (Auswahl wie oben), `title` (höchstens 60 Zeichen) und optional `text` (höchstens 200 Zeichen); zwei bis vier Einträge. Die Spaltenzahl ergibt sich aus der Anzahl der Einträge und der tatsächlichen Breite (Raster ab 12 rem je Merkmal), nicht aus einer eigenen Einstellung.
|
||||
| Höhe | `settings.height` | gemeinsamer Layoutvertrag (§12) |
|
||||
|
||||
**Abweichungen vom Kit (bewusst):**
|
||||
|
||||
@@ -57,3 +57,76 @@ .brand-tag--paket {
|
||||
--brand-tag-bg: var(--lf-tag-package-bg);
|
||||
--brand-tag-ink: var(--lf-tag-package-ink);
|
||||
}
|
||||
|
||||
/*
|
||||
* Gestaltung im Text (CMS): Symbol vor der Überschrift, Pinselstrich, Merkmalszeile.
|
||||
* Die Symbole haben feste Markenfarben mit viel Navy; auf dunklen Flächen stehen sie deshalb auf einer weißen Scheibe,
|
||||
* sonst verschwänden die Linien.
|
||||
*/
|
||||
.lf-heading-symbol {
|
||||
display: inline-block;
|
||||
inline-size: 1.2em;
|
||||
block-size: 1.2em;
|
||||
margin-inline-end: 0.35em;
|
||||
vertical-align: -0.2em;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.lf-heading-brush {
|
||||
display: block;
|
||||
inline-size: 7rem;
|
||||
max-inline-size: 60%;
|
||||
block-size: auto;
|
||||
margin-block: 0.2rem var(--space-2);
|
||||
}
|
||||
|
||||
.scope-dark .lf-heading-symbol,
|
||||
.scope-accent .lf-heading-symbol,
|
||||
.lf-bt--navy .lf-heading-symbol,
|
||||
.lf-hero--editorial-solid .lf-heading-symbol,
|
||||
.scope-dark .lf-features__symbol,
|
||||
.scope-accent .lf-features__symbol {
|
||||
box-sizing: content-box;
|
||||
padding: 0.14em;
|
||||
border-radius: 50%;
|
||||
background: var(--lf-white);
|
||||
}
|
||||
|
||||
.lf-features {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
|
||||
gap: var(--space-5) var(--space-4);
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.lf-features__item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: var(--space-2);
|
||||
min-inline-size: 0;
|
||||
}
|
||||
|
||||
.lf-features__symbol {
|
||||
inline-size: 3.5rem;
|
||||
block-size: 3.5rem;
|
||||
flex: none;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.lf-features__title {
|
||||
margin: 0;
|
||||
color: var(--color-heading);
|
||||
font-size: var(--text-h3);
|
||||
font-weight: 700;
|
||||
line-height: 1.25;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.lf-features__text {
|
||||
margin: 0;
|
||||
max-inline-size: var(--measure);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
@props(['settings' => []])
|
||||
@if (\App\Domain\Cms\Widgets\Support\HeadingAccent::hasBrush(is_array($settings) ? $settings : []))<x-brand.symbol name="gelbe-unterstreichung" class="lf-heading-brush" />@endif
|
||||
@@ -0,0 +1 @@
|
||||
@props(['settings' => []])@php($symbol = \App\Domain\Cms\Widgets\Support\HeadingAccent::symbol(is_array($settings) ? $settings : []))@if ($symbol !== null)<x-brand.symbol :name="$symbol" class="lf-heading-symbol" />@endif
|
||||
@@ -1,7 +1 @@
|
||||
{{--
|
||||
Markensymbol aus dem Kit (resources/svg/brand/symbole), inline und rein dekorativ (aria-hidden).
|
||||
Die Größe wird per Klasse oder Style gesetzt (Standard: 1.5em). Beispiel: <x-brand.symbol name="filmklappe" />.
|
||||
Ein unbekannter Name wirft einen Fehler.
|
||||
--}}
|
||||
@props(['name'])
|
||||
{!! \App\Support\Brand\Symbols::symbol($name, $attributes->class(['brand-symbol'])->toHtml()) !!}
|
||||
@props(['name']){!! \App\Support\Brand\Symbols::symbol($name, $attributes->class(['brand-symbol'])->toHtml()) !!}
|
||||
@@ -1,5 +1,5 @@
|
||||
<div class="cta">
|
||||
<h2>{{ $data['heading'] ?? '' }}</h2>
|
||||
<h2><x-brand.heading-symbol :settings="$settings" />{{ $data['heading'] ?? '' }}</h2>
|
||||
@if (filled($data['text'] ?? null))
|
||||
<p>{{ $data['text'] }}</p>
|
||||
@endif
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
{{--
|
||||
Merkmalszeile: zwei bis vier Merkmale mit Symbol, Kurztitel und Satz. Die Spaltenzahl folgt der Anzahl der Einträge
|
||||
und der tatsächlichen Breite (Raster mit Mindestbreite). Die Symbole sind Zierde; der Kurztitel trägt die Aussage.
|
||||
--}}
|
||||
@if ($items !== [])
|
||||
<ul class="lf-features lf-features--{{ count($items) }}">
|
||||
@foreach ($items as $item)
|
||||
<li class="lf-features__item">
|
||||
@if ($item['symbol'] !== null)
|
||||
<x-brand.symbol :name="$item['symbol']" class="lf-features__symbol" />
|
||||
@endif
|
||||
<p class="lf-features__title">{{ $item['title'] }}</p>
|
||||
@if (filled($item['text']))
|
||||
<p class="lf-features__text">{{ $item['text'] }}</p>
|
||||
@endif
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
@@ -1,8 +1,9 @@
|
||||
@if (! empty($first))
|
||||
<h1>{{ $data['heading'] ?? '' }}</h1>
|
||||
<h1><x-brand.heading-symbol :settings="$settings" />{{ $data['heading'] ?? '' }}</h1>
|
||||
@else
|
||||
<h2>{{ $data['heading'] ?? '' }}</h2>
|
||||
<h2><x-brand.heading-symbol :settings="$settings" />{{ $data['heading'] ?? '' }}</h2>
|
||||
@endif
|
||||
<x-brand.heading-brush :settings="$settings" />
|
||||
@if (filled($data['intro'] ?? null))
|
||||
<p class="lede">{{ $data['intro'] }}</p>
|
||||
@endif
|
||||
@@ -38,7 +38,7 @@
|
||||
@if (filled($data['eyebrow'] ?? null))
|
||||
<p class="lf-hero__eyebrow">{{ $data['eyebrow'] }}</p>
|
||||
@endif
|
||||
<{{ $tag }} class="lf-hero__title">{{ $data['heading'] ?? '' }}</{{ $tag }}>
|
||||
<{{ $tag }} class="lf-hero__title"><x-brand.heading-symbol :settings="$settings" />{{ $data['heading'] ?? '' }}</{{ $tag }}>
|
||||
@if ($accent !== 'none')
|
||||
<span class="lf-hero__title-accent" aria-hidden="true"></span>
|
||||
@endif
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<p class="lf-bt__eyebrow">{{ $data['eyebrow'] }}</p>
|
||||
@endif
|
||||
@if (filled($data['title'] ?? null))
|
||||
<{{ $tag }} class="lf-bt__headline">{{ $data['title'] }}</{{ $tag }}>
|
||||
<{{ $tag }} class="lf-bt__headline"><x-brand.heading-symbol :settings="$settings" />{{ $data['title'] }}</{{ $tag }}>
|
||||
<span class="lf-bt__accent" aria-hidden="true"></span>
|
||||
@endif
|
||||
<div class="lf-bt__body">{!! $body !!}</div>
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Domain\Cms\Page;
|
||||
use App\Domain\Cms\PageService;
|
||||
use App\Domain\Cms\Widgets\WidgetRegistry;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Kleingrafiken des Brand-Kits im Redaktionsinhalt: Symbol vor der Überschrift (Überschrift, Einstieg, Bild und Text,
|
||||
* Handlungsaufruf), Pinselstrich unter der Überschrift und die Merkmalszeile.
|
||||
*/
|
||||
class CmsBrandSymbolsTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $widget
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function widget(string $type, array $data, array $settings = [], string $variant = 'standard'): array
|
||||
{
|
||||
$registry = app(WidgetRegistry::class);
|
||||
|
||||
return ['type' => $type, 'v' => $registry->get($type)->version(), 'variant' => $variant, 'settings' => $settings, 'data' => $data];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $widget
|
||||
*/
|
||||
private function publish(string $path, array $widget, string $layout = 'u4'): string
|
||||
{
|
||||
$page = Page::query()->create(['path' => $path]);
|
||||
$service = app(PageService::class);
|
||||
$content = [['type' => 'heading', 'v' => 1, 'data' => ['heading' => 'Seite']], ['layout' => $layout, 'style' => [], 'slots' => [$widget]]];
|
||||
$service->publish($page, $service->saveRevision($page, $content, null, null, null));
|
||||
|
||||
return $this->get($path)->assertOk()->getContent();
|
||||
}
|
||||
|
||||
public function test_a_heading_shows_its_symbol_inside_the_heading_and_the_brush_below(): void
|
||||
{
|
||||
$html = $this->publish('/symbol', $this->widget('heading', ['heading' => 'Filme', 'intro' => 'Kurz erklärt'], ['symbol' => 'filmklappe', 'accent' => 'brush']));
|
||||
|
||||
$this->assertMatchesRegularExpression('~<h2><svg[^>]*aria-hidden="true"[^>]*class="brand-symbol lf-heading-symbol"[^>]*>.*?</svg>Filme</h2>~s', $html);
|
||||
$this->assertMatchesRegularExpression('~<svg[^>]*class="brand-symbol lf-heading-brush"~', $html);
|
||||
$this->assertStringNotContainsString('motif-title', $html, 'Die Kit-ID darf nie auf der Seite stehen.');
|
||||
}
|
||||
|
||||
public function test_without_settings_the_heading_is_unchanged(): void
|
||||
{
|
||||
$html = $this->publish('/ohne', $this->widget('heading', ['heading' => 'Filme']));
|
||||
|
||||
$this->assertStringContainsString('<h2>Filme</h2>', $html);
|
||||
$this->assertStringNotContainsString('lf-heading-symbol', $html);
|
||||
$this->assertStringNotContainsString('lf-heading-brush', $html);
|
||||
}
|
||||
|
||||
public function test_hero_image_text_and_call_to_action_show_the_symbol_too(): void
|
||||
{
|
||||
$hero = $this->publish('/hero', $this->widget('hero', ['heading' => 'Einstieg'], ['symbol' => 'schutzschild'], 'editorial_solid'));
|
||||
$this->assertMatchesRegularExpression('~class="lf-hero__title"><svg[^>]*lf-heading-symbol~', $hero);
|
||||
|
||||
$imageText = $this->publish('/bild-text', $this->widget('image_text', ['title' => 'Ansatz', 'body' => '<p>Text</p>'], ['symbol' => 'buch'], 'image_left'));
|
||||
$this->assertMatchesRegularExpression('~class="lf-bt__headline"><svg[^>]*lf-heading-symbol~', $imageText);
|
||||
|
||||
$cta = $this->publish('/aufruf', $this->widget('call_to_action', ['heading' => 'Jetzt', 'label' => 'Los', 'url' => '/angebote'], ['symbol' => 'paket']));
|
||||
$this->assertMatchesRegularExpression('~<h2><svg[^>]*lf-heading-symbol~', $cta);
|
||||
}
|
||||
|
||||
public function test_an_image_text_without_a_symbol_keeps_its_exact_headline_markup(): void
|
||||
{
|
||||
$html = $this->publish('/bild-text-ohne', $this->widget('image_text', ['title' => 'Geschichten', 'body' => '<p>Text</p>'], [], 'image_left'));
|
||||
|
||||
$this->assertStringContainsString('<h2 class="lf-bt__headline">Geschichten</h2>', $html);
|
||||
}
|
||||
|
||||
public function test_unknown_symbols_and_accents_are_rejected_when_saving(): void
|
||||
{
|
||||
foreach ([['symbol' => '../../.env'], ['symbol' => 'signalstrahlen'], ['symbol' => 'gelbe-unterstreichung'], ['accent' => 'rays']] as $settings) {
|
||||
try {
|
||||
$this->publish('/abgelehnt-'.md5(json_encode($settings)), $this->widget('heading', ['heading' => 'Filme'], $settings));
|
||||
$this->fail('Angenommen: '.json_encode($settings));
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertStringContainsString('nicht freigegeben', implode(' ', array_merge(...array_values($exception->errors()))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function test_the_features_row_renders_symbols_titles_and_text_with_one_column_per_item(): void
|
||||
{
|
||||
$items = [
|
||||
['symbol' => 'filmklappe', 'title' => 'Film', 'text' => 'Kurz erklärt'],
|
||||
['symbol' => 'uebungsblatt', 'title' => 'Übung', 'text' => null],
|
||||
['symbol' => 'merkblatt', 'title' => 'Merkblatt', 'text' => 'Zum Mitnehmen'],
|
||||
];
|
||||
$html = $this->publish('/merkmale', $this->widget('features', ['items' => $items]));
|
||||
|
||||
$this->assertStringContainsString('class="lf-features lf-features--3"', $html);
|
||||
$this->assertSame(3, substr_count($html, 'class="lf-features__item"'));
|
||||
$this->assertSame(3, preg_match_all('~<svg[^>]*aria-hidden="true"[^>]*class="brand-symbol lf-features__symbol"~', $html));
|
||||
$this->assertStringContainsString('<p class="lf-features__title">Übung</p>', $html);
|
||||
$this->assertStringContainsString('<p class="lf-features__text">Zum Mitnehmen</p>', $html);
|
||||
$this->assertSame(2, substr_count($html, 'lf-features__text'), 'Ohne Satz gibt es keinen leeren Absatz.');
|
||||
$this->assertStringNotContainsString('motif-title', $html);
|
||||
}
|
||||
|
||||
public function test_the_features_row_needs_two_to_four_items_with_a_known_symbol(): void
|
||||
{
|
||||
$item = fn (string $symbol = 'buch'): array => ['symbol' => $symbol, 'title' => 'Titel', 'text' => null];
|
||||
|
||||
foreach ([[$item()], array_fill(0, 5, $item()), [$item(), $item('nicht-vorhanden')], [$item(), ['symbol' => 'buch', 'title' => '', 'text' => null]]] as $index => $items) {
|
||||
try {
|
||||
$this->publish('/merkmale-falsch-'.$index, $this->widget('features', ['items' => $items]));
|
||||
$this->fail("Fall $index wurde angenommen.");
|
||||
} catch (ValidationException $exception) {
|
||||
$this->assertNotEmpty($exception->errors(), "Fall $index");
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertStringContainsString('lf-features--2', $this->publish('/merkmale-zwei', $this->widget('features', ['items' => [$item(), $item('gruppe')]])));
|
||||
$this->assertStringContainsString('lf-features--4', $this->publish('/merkmale-vier', $this->widget('features', ['items' => array_fill(0, 4, $item())])));
|
||||
}
|
||||
|
||||
public function test_the_features_row_is_not_offered_in_a_single_unit_slot(): void
|
||||
{
|
||||
$this->assertFalse(app(WidgetRegistry::class)->get('features')->supportsUnits(1));
|
||||
$this->assertTrue(app(WidgetRegistry::class)->get('features')->supportsUnits(2));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\Domain\Cms\Widgets\Support\HeadingAccent;
|
||||
use App\Support\Brand\Symbols;
|
||||
use Tests\TestCase;
|
||||
|
||||
class HeadingAccentTest extends TestCase
|
||||
{
|
||||
public function test_every_offered_symbol_has_a_file_and_only_the_two_accents_are_withheld(): void
|
||||
{
|
||||
$files = Symbols::names();
|
||||
$offered = array_keys(HeadingAccent::SYMBOLS);
|
||||
|
||||
$this->assertSame([], array_values(array_diff($offered, $files)), 'Jede Auswahl braucht eine vorhandene Datei.');
|
||||
$this->assertSame(['gelbe-unterstreichung', 'signalstrahlen'], array_values(array_diff($files, $offered)), 'Unterstreichung und Strahlen haben eigene Einstellungen.');
|
||||
}
|
||||
|
||||
public function test_labels_are_present_for_every_symbol(): void
|
||||
{
|
||||
foreach (HeadingAccent::SYMBOLS as $name => $label) {
|
||||
$this->assertNotSame('', trim($label), $name);
|
||||
}
|
||||
}
|
||||
|
||||
public function test_only_known_names_are_accepted(): void
|
||||
{
|
||||
$this->assertSame('buch', HeadingAccent::symbol(['symbol' => 'buch']));
|
||||
$this->assertNull(HeadingAccent::symbol([]));
|
||||
$this->assertNull(HeadingAccent::symbol(['symbol' => '']));
|
||||
$this->assertNull(HeadingAccent::symbol(['symbol' => '../../.env']));
|
||||
$this->assertNull(HeadingAccent::symbol(['symbol' => 'signalstrahlen']));
|
||||
$this->assertNull(HeadingAccent::symbol(['symbol' => ['buch']]));
|
||||
}
|
||||
|
||||
public function test_the_brush_needs_the_exact_value(): void
|
||||
{
|
||||
$this->assertTrue(HeadingAccent::hasBrush(['accent' => 'brush']));
|
||||
$this->assertFalse(HeadingAccent::hasBrush(['accent' => 'rays']));
|
||||
$this->assertFalse(HeadingAccent::hasBrush([]));
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ public function test_all_configured_widgets_are_registered_with_complete_contrac
|
||||
$types = $this->registry()->all();
|
||||
|
||||
$this->assertSame(
|
||||
['hero', 'heading', 'prose', 'image_text', 'cards', 'catalog_cards', 'topic_card', 'media_card', 'program_card', 'call_to_action', 'faq'],
|
||||
['hero', 'heading', 'prose', 'image_text', 'cards', 'features', 'catalog_cards', 'topic_card', 'media_card', 'program_card', 'call_to_action', 'faq'],
|
||||
array_keys($types),
|
||||
);
|
||||
|
||||
|
||||
Reference in new issue
Block a user