Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c7a71532f |
No files matched your search
@@ -36,6 +36,34 @@ final class HeadingAccent
|
|||||||
|
|
||||||
public const BRUSH_LABEL = ['Pinselstrich', 'Gelbe Unterstreichung unter der Überschrift (freigegebenes Motiv aus dem Brand-Kit). Vorgabe: ohne.'];
|
public const BRUSH_LABEL = ['Pinselstrich', 'Gelbe Unterstreichung unter der Überschrift (freigegebenes Motiv aus dem Brand-Kit). Vorgabe: ohne.'];
|
||||||
|
|
||||||
|
/** @var array<string, string> */
|
||||||
|
public const SIZE = ['large' => 'Groß, links neben dem ganzen Absatz'];
|
||||||
|
|
||||||
|
public const SIZE_LABEL = ['Größe des Symbols', 'Vorgabe: klein, vor der Überschrift. „Groß“ stellt das Symbol links neben Überschrift und Text; bei wenig Platz steht es darüber. Wirkt nur, wenn ein Symbol gewählt ist.'];
|
||||||
|
|
||||||
|
/** @var array<string, string> */
|
||||||
|
public const LINK_STYLE = ['text' => 'Kleiner Textlink', 'pill' => 'Pille (Schaltfläche)'];
|
||||||
|
|
||||||
|
public const LINK_STYLE_LABEL = ['Darstellung der Links', 'Wie die Links der Merkmale aussehen. Vorgabe: kleiner Textlink. Merkmale ohne Link zeigen nichts.'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Großes Symbol links neben dem ganzen Absatz: nur mit gültigem Symbol und Einstellung „large“.
|
||||||
|
*
|
||||||
|
* @param array<string, mixed> $settings
|
||||||
|
*/
|
||||||
|
public static function isLarge(array $settings): bool
|
||||||
|
{
|
||||||
|
return self::symbol($settings) !== null && ($settings['symbol_size'] ?? null) === 'large';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $settings
|
||||||
|
*/
|
||||||
|
public static function linkStyle(array $settings): string
|
||||||
|
{
|
||||||
|
return ($settings['link_style'] ?? null) === 'pill' ? 'pill' : 'text';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gültiger Symbolname aus den Einstellungen eines Widgets oder null.
|
* Gültiger Symbolname aus den Einstellungen eines Widgets oder null.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -93,17 +93,17 @@ public function dataFields(): array
|
|||||||
|
|
||||||
public function settings(): array
|
public function settings(): array
|
||||||
{
|
{
|
||||||
return ['symbol' => HeadingAccent::SYMBOLS];
|
return ['symbol' => HeadingAccent::SYMBOLS, 'symbol_size' => HeadingAccent::SIZE];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function settingGroups(): array
|
public function settingGroups(): array
|
||||||
{
|
{
|
||||||
return ['Aussehen' => ['symbol']];
|
return ['Aussehen' => ['symbol', 'symbol_size']];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function settingLabels(): array
|
public function settingLabels(): array
|
||||||
{
|
{
|
||||||
return ['symbol' => HeadingAccent::SYMBOL_LABEL];
|
return ['symbol' => HeadingAccent::SYMBOL_LABEL, 'symbol_size' => HeadingAccent::SIZE_LABEL];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function clean(array $data, array $refs, WidgetErrors $errors): array
|
public function clean(array $data, array $refs, WidgetErrors $errors): array
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
use App\Domain\Cms\Widgets\RenderContext;
|
use App\Domain\Cms\Widgets\RenderContext;
|
||||||
use App\Domain\Cms\Widgets\Support\HeadingAccent;
|
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\WidgetErrors;
|
||||||
use App\Domain\Cms\Widgets\WidgetType;
|
use App\Domain\Cms\Widgets\WidgetType;
|
||||||
use Filament\Forms\Components\Repeater;
|
use Filament\Forms\Components\Repeater;
|
||||||
@@ -20,6 +21,8 @@
|
|||||||
*/
|
*/
|
||||||
class FeaturesWidget extends WidgetType
|
class FeaturesWidget extends WidgetType
|
||||||
{
|
{
|
||||||
|
private const DEFAULT_LINK_LABEL = 'Mehr erfahren';
|
||||||
|
|
||||||
public function key(): string
|
public function key(): string
|
||||||
{
|
{
|
||||||
return 'features';
|
return 'features';
|
||||||
@@ -75,9 +78,26 @@ public function dataRules(): array
|
|||||||
'items.*.symbol' => ['required', 'string', Rule::in(array_keys(HeadingAccent::SYMBOLS))],
|
'items.*.symbol' => ['required', 'string', Rule::in(array_keys(HeadingAccent::SYMBOLS))],
|
||||||
'items.*.title' => ['required', 'string', 'max:60'],
|
'items.*.title' => ['required', 'string', 'max:60'],
|
||||||
'items.*.text' => ['nullable', 'string', 'max:200'],
|
'items.*.text' => ['nullable', 'string', 'max:200'],
|
||||||
|
'items.*.url' => ['nullable', 'string', 'max:500'],
|
||||||
|
'items.*.link_label' => ['nullable', 'string', 'max:60'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function settings(): array
|
||||||
|
{
|
||||||
|
return ['link_style' => HeadingAccent::LINK_STYLE];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function settingGroups(): array
|
||||||
|
{
|
||||||
|
return ['Aussehen' => ['link_style']];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function settingLabels(): array
|
||||||
|
{
|
||||||
|
return ['link_style' => HeadingAccent::LINK_STYLE_LABEL];
|
||||||
|
}
|
||||||
|
|
||||||
public function dataFields(): array
|
public function dataFields(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@@ -87,6 +107,16 @@ public function dataFields(): array
|
|||||||
Select::make('symbol')->label('Symbol')->options(HeadingAccent::SYMBOLS)->required(),
|
Select::make('symbol')->label('Symbol')->options(HeadingAccent::SYMBOLS)->required(),
|
||||||
TextInput::make('title')->label('Kurztitel')->required()->maxLength(60),
|
TextInput::make('title')->label('Kurztitel')->required()->maxLength(60),
|
||||||
Textarea::make('text')->label('Satz')->rows(2)->maxLength(200),
|
Textarea::make('text')->label('Satz')->rows(2)->maxLength(200),
|
||||||
|
TextInput::make('url')
|
||||||
|
->label('Linkziel (optional)')
|
||||||
|
->maxLength(500)
|
||||||
|
->rule(SafeUrl::rule())
|
||||||
|
->helperText('Seitenpfad wie /materialien oder eine http(s)-Adresse. Leer lassen für ein Merkmal ohne Link.'),
|
||||||
|
TextInput::make('link_label')
|
||||||
|
->label('Linktext')
|
||||||
|
->maxLength(60)
|
||||||
|
->placeholder(self::DEFAULT_LINK_LABEL)
|
||||||
|
->helperText('Nur mit Linkziel. Leer: „'.self::DEFAULT_LINK_LABEL.'“.'),
|
||||||
])
|
])
|
||||||
->minItems(2)
|
->minItems(2)
|
||||||
->maxItems(4)
|
->maxItems(4)
|
||||||
@@ -101,10 +131,19 @@ public function dataFields(): array
|
|||||||
public function clean(array $data, array $refs, WidgetErrors $errors): array
|
public function clean(array $data, array $refs, WidgetErrors $errors): array
|
||||||
{
|
{
|
||||||
foreach ($data['items'] as $index => $item) {
|
foreach ($data['items'] as $index => $item) {
|
||||||
|
$hasUrl = filled($item['url'] ?? null);
|
||||||
|
|
||||||
|
if ($hasUrl && ! SafeUrl::isSafe($item['url'])) {
|
||||||
|
$errors->add("data.items.$index.url", SafeUrl::message());
|
||||||
|
}
|
||||||
|
|
||||||
$data['items'][$index] = [
|
$data['items'][$index] = [
|
||||||
'symbol' => $item['symbol'],
|
'symbol' => $item['symbol'],
|
||||||
'title' => $item['title'],
|
'title' => $item['title'],
|
||||||
'text' => filled($item['text'] ?? null) ? $item['text'] : null,
|
'text' => filled($item['text'] ?? null) ? $item['text'] : null,
|
||||||
|
'url' => $hasUrl ? $item['url'] : null,
|
||||||
|
// Ein Linktext ohne Linkziel wird verworfen, damit nichts Verstecktes gespeichert bleibt.
|
||||||
|
'link_label' => $hasUrl && filled($item['link_label'] ?? null) ? $item['link_label'] : null,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,10 +163,12 @@ public function resolve(array $widget, RenderContext $context): array
|
|||||||
'symbol' => HeadingAccent::symbol(['symbol' => $item['symbol'] ?? null]),
|
'symbol' => HeadingAccent::symbol(['symbol' => $item['symbol'] ?? null]),
|
||||||
'title' => $item['title'],
|
'title' => $item['title'],
|
||||||
'text' => $item['text'] ?? null,
|
'text' => $item['text'] ?? null,
|
||||||
|
'url' => SafeUrl::isSafe($item['url'] ?? null) ? $item['url'] : null,
|
||||||
|
'linkLabel' => filled($item['link_label'] ?? null) ? $item['link_label'] : self::DEFAULT_LINK_LABEL,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return ['items' => $items];
|
return ['items' => $items, 'linkStyle' => HeadingAccent::linkStyle($widget['settings'] ?? [])];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function summary(array $widget): string
|
public function summary(array $widget): string
|
||||||
|
|||||||
@@ -76,19 +76,21 @@ public function settings(): array
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'symbol' => HeadingAccent::SYMBOLS,
|
'symbol' => HeadingAccent::SYMBOLS,
|
||||||
|
'symbol_size' => HeadingAccent::SIZE,
|
||||||
'accent' => HeadingAccent::BRUSH,
|
'accent' => HeadingAccent::BRUSH,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function settingGroups(): array
|
public function settingGroups(): array
|
||||||
{
|
{
|
||||||
return ['Aussehen' => ['symbol', 'accent']];
|
return ['Aussehen' => ['symbol', 'symbol_size', 'accent']];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function settingLabels(): array
|
public function settingLabels(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'symbol' => HeadingAccent::SYMBOL_LABEL,
|
'symbol' => HeadingAccent::SYMBOL_LABEL,
|
||||||
|
'symbol_size' => HeadingAccent::SIZE_LABEL,
|
||||||
'accent' => HeadingAccent::BRUSH_LABEL,
|
'accent' => HeadingAccent::BRUSH_LABEL,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 128 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 113 KiB |
@@ -44,6 +44,9 @@ ## 1b. Stand der Umsetzung Stufe 3: Gestaltung im Redaktionsinhalt (Branch `feat
|
|||||||
- **Pinselstrich** (`settings.accent` = `brush`) unter der Überschrift des Widgets Überschrift und Einleitung, mit dem freigegebenen Motiv „gelbe-unterstreichung“.
|
- **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.
|
- **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.
|
- **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.
|
||||||
|
- **Großes Symbol** (`settings.symbol_size` = `large`, nach der ersten Sichtung auf luf-test): Das Symbol steht links neben dem ganzen Absatz (Überschrift, Text, Schaltfläche) und bei wenig Platz darüber. Bei Überschrift und Einleitung sowie beim Handlungsaufruf wählbar; Vorgabe bleibt das kleine Symbol vor der Überschrift. Einstieg und Bild und Text haben es noch nicht.
|
||||||
|
- **Links in der Merkmalszeile:** je Merkmal optional Linkziel und Linktext (Vorgabe „Mehr erfahren“); die Einstellung „Darstellung der Links“ wählt für das ganze Widget kleiner Textlink (Vorgabe) oder Pille.
|
||||||
|
- **Beleg (großes Symbol, Links):** `16_Lara-Felix-Kleingrafiken/abnahme/cms-symbol-gross-merkmal-links-breit.png` und `…-schmal.png`.
|
||||||
- **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.
|
- **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).
|
Nicht umgesetzt: Symbole mitten im Fließtext (Stufe 3b, braucht einen Symbol-Knopf im Editor) und die Lernbausteine im Player (Stufe 4).
|
||||||
|
|||||||
@@ -99,11 +99,12 @@ ## 4. Registrierte Widget-Arten
|
|||||||
| Akzent (Einstieg) | `settings.accent` | `underline` (Vorgabe), `rays`, `none` |
|
| Akzent (Einstieg) | `settings.accent` | `underline` (Vorgabe), `rays`, `none` |
|
||||||
| Fläche (Bild und Text) | `settings.surface` | `cream` (Vorgabe), `clear` (übernimmt den Abschnitt), `navy` |
|
| 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 |
|
| 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 |
|
||||||
|
| Größe des Symbols | `settings.symbol_size` = `large` | nur Überschrift und Einleitung sowie Handlungsaufruf; Vorgabe klein vor der Überschrift. „large“ stellt das Symbol links neben den ganzen Absatz (`lf-lead`), bei höchstens 24 rem Slotbreite darüber. Wirkt nur mit gewähltem Symbol |
|
||||||
| Pinselstrich (Überschrift) | `settings.accent` = `brush` | nur Widget „Überschrift und Einleitung“; Motiv „gelbe-unterstreichung“ des Kits |
|
| 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) |
|
| Höhe | `settings.height` | gemeinsamer Layoutvertrag (§12) |
|
||||||
|
|
||||||
|
**Merkmalszeile.** `data.items[]` mit `symbol` (Auswahl wie oben), `title` (höchstens 60 Zeichen) und optional `text` (höchstens 200 Zeichen), `url` (über `SafeUrl`) und `link_label` (höchstens 60 Zeichen, Vorgabe „Mehr erfahren“, wird ohne `url` verworfen); 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. `settings.link_style` bestimmt für alle Links des Widgets die Darstellung: `text` (kleiner Textlink, Vorgabe) oder `pill` (Pille). Der zugängliche Name des Links nennt das Merkmal („Mehr erfahren: Kurze Filme“).
|
||||||
|
|
||||||
**Abweichungen vom Kit (bewusst):**
|
**Abweichungen vom Kit (bewusst):**
|
||||||
- Kennungen bleiben `hero` und `image_text`, nicht `lf-brand-hero`/`lf-editorial-bild-text`; Varianten `photo_split`/`editorial_solid` mit Unterstrich, weil Variantenkennungen `^[a-z][a-z0-9_]*$` folgen.
|
- Kennungen bleiben `hero` und `image_text`, nicht `lf-brand-hero`/`lf-editorial-bild-text`; Varianten `photo_split`/`editorial_solid` mit Unterstrich, weil Variantenkennungen `^[a-z][a-z0-9_]*$` folgen.
|
||||||
- Bildseite von Bild und Text bleibt die Variante (`image_left/right`), nicht zusätzlich `settings.image_side`, damit es keine doppelte Einstellung gibt.
|
- Bildseite von Bild und Text bleibt die Variante (`image_left/right`), nicht zusätzlich `settings.image_side`, damit es keine doppelte Einstellung gibt.
|
||||||
|
|||||||
@@ -130,3 +130,84 @@ .lf-features__text {
|
|||||||
max-inline-size: var(--measure);
|
max-inline-size: var(--measure);
|
||||||
overflow-wrap: anywhere;
|
overflow-wrap: anywhere;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.lf-features__more {
|
||||||
|
margin: var(--space-1) 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Link der Merkmale: kleiner Textlink (Vorgabe) oder Pille. */
|
||||||
|
.lf-features__link {
|
||||||
|
font-weight: 700;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-features__link--text {
|
||||||
|
color: var(--color-link);
|
||||||
|
font-size: 0.9375rem;
|
||||||
|
text-decoration: underline;
|
||||||
|
text-underline-offset: 0.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-features__link--text:hover {
|
||||||
|
color: var(--color-link-hover, var(--color-link));
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-features__link--pill {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0.5em 1.1em;
|
||||||
|
border-radius: var(--radius-pill);
|
||||||
|
background: var(--color-action);
|
||||||
|
color: var(--color-action-text);
|
||||||
|
font-size: 0.9375rem;
|
||||||
|
line-height: 1.25;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-features__link--pill:hover {
|
||||||
|
background: var(--color-action-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-features__link:focus-visible {
|
||||||
|
outline: 3px solid var(--color-focus, var(--lf-focus));
|
||||||
|
outline-offset: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Großes Symbol links neben dem ganzen Absatz (Einstellung „Größe des Symbols“ = groß): Überschrift, Text und
|
||||||
|
* Schaltfläche stehen in einer Spalte rechts. Bei wenig Platz im Slot steht das Symbol darüber.
|
||||||
|
*/
|
||||||
|
.lf-lead {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: var(--space-4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-lead__symbol {
|
||||||
|
inline-size: clamp(4.5rem, 12cqi, 7rem);
|
||||||
|
block-size: clamp(4.5rem, 12cqi, 7rem);
|
||||||
|
flex: none;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-lead__body {
|
||||||
|
flex: 1 1 0;
|
||||||
|
min-inline-size: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lf-lead__body > :first-child {
|
||||||
|
margin-block-start: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@container slot (max-width: 24rem) {
|
||||||
|
.lf-lead {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.scope-dark .lf-lead__symbol,
|
||||||
|
.scope-accent .lf-lead__symbol {
|
||||||
|
box-sizing: content-box;
|
||||||
|
padding: 0.5rem;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--lf-white);
|
||||||
|
}
|
||||||
@@ -1,9 +1,16 @@
|
|||||||
|
@php
|
||||||
|
$symbol = \App\Domain\Cms\Widgets\Support\HeadingAccent::symbol($settings);
|
||||||
|
$large = \App\Domain\Cms\Widgets\Support\HeadingAccent::isLarge($settings);
|
||||||
|
$inline = $large ? [] : $settings;
|
||||||
|
@endphp
|
||||||
<div class="cta">
|
<div class="cta">
|
||||||
<h2><x-brand.heading-symbol :settings="$settings" />{{ $data['heading'] ?? '' }}</h2>
|
@if ($large)<div class="lf-lead"><x-brand.symbol :name="$symbol" class="lf-lead__symbol" /><div class="lf-lead__body">@endif
|
||||||
|
<h2><x-brand.heading-symbol :settings="$inline" />{{ $data['heading'] ?? '' }}</h2>
|
||||||
@if (filled($data['text'] ?? null))
|
@if (filled($data['text'] ?? null))
|
||||||
<p>{{ $data['text'] }}</p>
|
<p>{{ $data['text'] }}</p>
|
||||||
@endif
|
@endif
|
||||||
@if (\App\Domain\Cms\Widgets\Support\SafeUrl::isSafe($data['url'] ?? null))
|
@if (\App\Domain\Cms\Widgets\Support\SafeUrl::isSafe($data['url'] ?? null))
|
||||||
<a class="button" href="{{ $data['url'] }}">{{ $data['label'] ?? '' }}</a>
|
<a class="button" href="{{ $data['url'] }}">{{ $data['label'] ?? '' }}</a>
|
||||||
@endif
|
@endif
|
||||||
|
@if ($large)</div></div>@endif
|
||||||
</div>
|
</div>
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
{{--
|
{{--
|
||||||
Merkmalszeile: zwei bis vier Merkmale mit Symbol, Kurztitel und Satz. Die Spaltenzahl folgt der Anzahl der Einträge
|
Merkmalszeile: zwei bis vier Merkmale mit Symbol, Kurztitel, Satz und optionalem Link. Die Spaltenzahl folgt der Anzahl
|
||||||
und der tatsächlichen Breite (Raster mit Mindestbreite). Die Symbole sind Zierde; der Kurztitel trägt die Aussage.
|
der Einträge und der tatsächlichen Breite (Raster mit Mindestbreite). Die Symbole sind Zierde; der Kurztitel trägt die
|
||||||
|
Aussage. Der Link erscheint als kleiner Textlink oder als Pille (Einstellung link_style); sein zugänglicher Name nennt
|
||||||
|
das Merkmal, damit mehrere „Mehr erfahren“ unterscheidbar bleiben.
|
||||||
--}}
|
--}}
|
||||||
@if ($items !== [])
|
@if ($items !== [])
|
||||||
<ul class="lf-features lf-features--{{ count($items) }}">
|
<ul class="lf-features lf-features--{{ count($items) }}">
|
||||||
@@ -13,6 +15,9 @@
|
|||||||
@if (filled($item['text']))
|
@if (filled($item['text']))
|
||||||
<p class="lf-features__text">{{ $item['text'] }}</p>
|
<p class="lf-features__text">{{ $item['text'] }}</p>
|
||||||
@endif
|
@endif
|
||||||
|
@if ($item['url'] !== null)
|
||||||
|
<p class="lf-features__more"><a class="lf-features__link lf-features__link--{{ $linkStyle }}" href="{{ $item['url'] }}" aria-label="{{ $item['linkLabel'] }}: {{ $item['title'] }}">{{ $item['linkLabel'] }}</a></p>
|
||||||
|
@endif
|
||||||
</li>
|
</li>
|
||||||
@endforeach
|
@endforeach
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
|
@php
|
||||||
|
$symbol = \App\Domain\Cms\Widgets\Support\HeadingAccent::symbol($settings);
|
||||||
|
$large = \App\Domain\Cms\Widgets\Support\HeadingAccent::isLarge($settings);
|
||||||
|
$inline = $large ? [] : $settings;
|
||||||
|
@endphp
|
||||||
|
@if ($large)<div class="lf-lead"><x-brand.symbol :name="$symbol" class="lf-lead__symbol" /><div class="lf-lead__body">@endif
|
||||||
@if (! empty($first))
|
@if (! empty($first))
|
||||||
<h1><x-brand.heading-symbol :settings="$settings" />{{ $data['heading'] ?? '' }}</h1>
|
<h1><x-brand.heading-symbol :settings="$inline" />{{ $data['heading'] ?? '' }}</h1>
|
||||||
@else
|
@else
|
||||||
<h2><x-brand.heading-symbol :settings="$settings" />{{ $data['heading'] ?? '' }}</h2>
|
<h2><x-brand.heading-symbol :settings="$inline" />{{ $data['heading'] ?? '' }}</h2>
|
||||||
@endif
|
@endif
|
||||||
<x-brand.heading-brush :settings="$settings" />
|
<x-brand.heading-brush :settings="$settings" />
|
||||||
@if (filled($data['intro'] ?? null))
|
@if (filled($data['intro'] ?? null))
|
||||||
<p class="lede">{{ $data['intro'] }}</p>
|
<p class="lede">{{ $data['intro'] }}</p>
|
||||||
@endif
|
@endif
|
||||||
|
@if ($large)</div></div>@endif
|
||||||
@@ -125,6 +125,73 @@ public function test_the_features_row_needs_two_to_four_items_with_a_known_symbo
|
|||||||
$this->assertStringContainsString('lf-features--4', $this->publish('/merkmale-vier', $this->widget('features', ['items' => array_fill(0, 4, $item())])));
|
$this->assertStringContainsString('lf-features--4', $this->publish('/merkmale-vier', $this->widget('features', ['items' => array_fill(0, 4, $item())])));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_a_large_symbol_stands_left_of_the_whole_paragraph_and_not_inside_the_heading(): void
|
||||||
|
{
|
||||||
|
$html = $this->publish('/gross', $this->widget('heading', ['heading' => 'Filme', 'intro' => 'Kurz erklärt'], ['symbol' => 'filmklappe', 'symbol_size' => 'large']));
|
||||||
|
|
||||||
|
$this->assertMatchesRegularExpression('~<div class="lf-lead"><svg[^>]*class="brand-symbol lf-lead__symbol"[^>]*>.*?</svg><div class="lf-lead__body">\s*<h2>Filme</h2>\s*<p class="lede">Kurz erklärt</p>\s*</div></div>~s', $html);
|
||||||
|
$this->assertStringNotContainsString('lf-heading-symbol', $html, 'Das kleine Symbol entfällt, sonst stünde es doppelt.');
|
||||||
|
|
||||||
|
$cta = $this->publish('/gross-aufruf', $this->widget('call_to_action', ['heading' => 'Jetzt', 'text' => 'Alles in einem.', 'label' => 'Los', 'url' => '/angebote'], ['symbol' => 'paket', 'symbol_size' => 'large']));
|
||||||
|
$this->assertMatchesRegularExpression('~<div class="cta">\s*<div class="lf-lead"><svg[^>]*lf-lead__symbol.*?<h2>Jetzt</h2>.*?<a class="button" href="/angebote">Los</a>\s*</div></div>\s*</div>~s', $cta);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_the_large_size_does_nothing_without_a_symbol_and_is_checked_when_saving(): void
|
||||||
|
{
|
||||||
|
$this->assertStringNotContainsString('lf-lead', $this->publish('/gross-ohne', $this->widget('heading', ['heading' => 'Filme'], ['symbol_size' => 'large'])));
|
||||||
|
$this->assertStringContainsString('<h2>Filme</h2>', $this->publish('/gross-ohne-2', $this->widget('heading', ['heading' => 'Filme'], ['symbol_size' => 'large'])));
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->publish('/gross-falsch', $this->widget('heading', ['heading' => 'Filme'], ['symbol' => 'buch', 'symbol_size' => 'huge']));
|
||||||
|
$this->fail('Eine unbekannte Größe wurde angenommen.');
|
||||||
|
} catch (ValidationException $exception) {
|
||||||
|
$this->assertStringContainsString('nicht freigegeben', implode(' ', array_merge(...array_values($exception->errors()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_feature_links_are_small_text_by_default_and_a_pill_on_request(): void
|
||||||
|
{
|
||||||
|
$items = [
|
||||||
|
['symbol' => 'filmklappe', 'title' => 'Film', 'text' => null, 'url' => '/materialien', 'link_label' => 'Alle Filme'],
|
||||||
|
['symbol' => 'buch', 'title' => 'Buch', 'text' => null, 'url' => 'https://example.org/buch', 'link_label' => null],
|
||||||
|
['symbol' => 'gruppe', 'title' => 'Gruppe', 'text' => null],
|
||||||
|
];
|
||||||
|
|
||||||
|
$text = $this->publish('/links-text', $this->widget('features', ['items' => $items]));
|
||||||
|
$this->assertStringContainsString('<a class="lf-features__link lf-features__link--text" href="/materialien" aria-label="Alle Filme: Film">Alle Filme</a>', $text);
|
||||||
|
$this->assertStringContainsString('<a class="lf-features__link lf-features__link--text" href="https://example.org/buch" aria-label="Mehr erfahren: Buch">Mehr erfahren</a>', $text);
|
||||||
|
$this->assertSame(2, substr_count($text, 'class="lf-features__more"'), 'Ohne Link gibt es keinen leeren Absatz.');
|
||||||
|
|
||||||
|
$pill = $this->publish('/links-pille', $this->widget('features', ['items' => $items], ['link_style' => 'pill']));
|
||||||
|
$this->assertSame(2, substr_count($pill, 'lf-features__link--pill'));
|
||||||
|
$this->assertStringNotContainsString('lf-features__link--text', $pill);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_feature_links_must_be_safe_and_a_label_without_a_link_is_dropped(): void
|
||||||
|
{
|
||||||
|
$item = fn (array $extra): array => ['symbol' => 'buch', 'title' => 'Titel', 'text' => null] + $extra;
|
||||||
|
|
||||||
|
foreach (['javascript:alert(1)', 'data:text/html,x', '//evil.example'] as $url) {
|
||||||
|
try {
|
||||||
|
$this->publish('/link-unsicher-'.md5($url), $this->widget('features', ['items' => [$item(['url' => $url]), $item([])]]));
|
||||||
|
$this->fail("Die Adresse $url wurde angenommen.");
|
||||||
|
} catch (ValidationException $exception) {
|
||||||
|
$this->assertNotEmpty($exception->errors(), $url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$html = $this->publish('/link-ohne-ziel', $this->widget('features', ['items' => [$item(['link_label' => 'Versteckt']), $item([])]]));
|
||||||
|
$this->assertStringNotContainsString('Versteckt', $html);
|
||||||
|
$this->assertStringNotContainsString('lf-features__link', $html);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->publish('/pille-falsch', $this->widget('features', ['items' => [$item([]), $item([])]], ['link_style' => 'button']));
|
||||||
|
$this->fail('Eine unbekannte Link-Darstellung wurde angenommen.');
|
||||||
|
} catch (ValidationException $exception) {
|
||||||
|
$this->assertStringContainsString('nicht freigegeben', implode(' ', array_merge(...array_values($exception->errors()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function test_the_features_row_is_not_offered_in_a_single_unit_slot(): void
|
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->assertFalse(app(WidgetRegistry::class)->get('features')->supportsUnits(1));
|
||||||
|
|||||||
@@ -34,6 +34,22 @@ public function test_only_known_names_are_accepted(): void
|
|||||||
$this->assertNull(HeadingAccent::symbol(['symbol' => ['buch']]));
|
$this->assertNull(HeadingAccent::symbol(['symbol' => ['buch']]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_large_needs_a_valid_symbol_and_the_exact_value(): void
|
||||||
|
{
|
||||||
|
$this->assertTrue(HeadingAccent::isLarge(['symbol' => 'buch', 'symbol_size' => 'large']));
|
||||||
|
$this->assertFalse(HeadingAccent::isLarge(['symbol_size' => 'large']));
|
||||||
|
$this->assertFalse(HeadingAccent::isLarge(['symbol' => 'nicht-vorhanden', 'symbol_size' => 'large']));
|
||||||
|
$this->assertFalse(HeadingAccent::isLarge(['symbol' => 'buch']));
|
||||||
|
$this->assertFalse(HeadingAccent::isLarge(['symbol' => 'buch', 'symbol_size' => 'huge']));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_the_link_style_falls_back_to_the_text_link(): void
|
||||||
|
{
|
||||||
|
$this->assertSame('pill', HeadingAccent::linkStyle(['link_style' => 'pill']));
|
||||||
|
$this->assertSame('text', HeadingAccent::linkStyle([]));
|
||||||
|
$this->assertSame('text', HeadingAccent::linkStyle(['link_style' => 'button']));
|
||||||
|
}
|
||||||
|
|
||||||
public function test_the_brush_needs_the_exact_value(): void
|
public function test_the_brush_needs_the_exact_value(): void
|
||||||
{
|
{
|
||||||
$this->assertTrue(HeadingAccent::hasBrush(['accent' => 'brush']));
|
$this->assertTrue(HeadingAccent::hasBrush(['accent' => 'brush']));
|
||||||
|
|||||||
Reference in new issue
Block a user