Design Stufe 2: Tipp-Karten zum Umdrehen, Sommer/Winter-Vergleich, Galerie mit weichem Vergroessern
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m45s

- Baustein "Ausflugstipps" (tips): Karten mit Foto vorne, Tipp/Weg/beste Zeit hinten; Seebad als Ansichtskarten
- Baustein "Sommer/Winter-Vergleich" (compare): Trennlinie ziehen, Tastatur ueber Range-Input, einmaliger Hinweis-Schwenk
- Lightbox: Foto waechst aus der Vorschau, Blaettern (Pfeile, Tasten, Wischen), Zaehler, Bildunterschrift; partials/lightbox
- Bewegung reduzieren: Ueberblenden statt Drehen, kein Schwenk, keine Zoom-Animation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Opus 5.5 committed 2026-10-30 21:05:16 +01:00
1 parent c8bb0f6e97
commit 4c9e6992f4
20 files changed
+785 -43

No files matched your search

+59
View File
@@ -0,0 +1,59 @@
<?php
namespace App\Themes\Sections;
use App\Themes\Theme;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
/**
* The same view in two seasons (e.g. terrace in summer and winter): guests drag a dividing line across the photo.
* Both photos are shown in every appearance – the comparison is the point, so season limits do not apply here.
*/
class CompareSection extends Section
{
public static function key(): string
{
return 'compare';
}
public static function label(): string
{
return 'Sommer/Winter-Vergleich';
}
public static function icon(): string
{
return 'heroicon-o-arrows-right-left';
}
public static function schema(): array
{
return [
TextInput::make('eyebrow')->label('Kleine Überschrift')->maxLength(100),
TextInput::make('heading')->label('Überschrift')->default('Derselbe Blick, zwei Jahreszeiten')->maxLength(160),
Textarea::make('text')->label('Text')->rows(2)->maxLength(400),
static::photoSelect('first_photo_id', 'Erstes Foto (links)')
->helperText('Am besten vom selben Standpunkt aufgenommen wie das zweite Foto. Beide erscheinen in jedem Erscheinungsbild.')
->required(),
TextInput::make('first_label')->label('Bezeichnung erstes Foto')->default('Sommer')->required()->maxLength(30),
static::photoSelect('second_photo_id', 'Zweites Foto (rechts)')->required(),
TextInput::make('second_label')->label('Bezeichnung zweites Foto')->default('Winter')->required()->maxLength(30),
];
}
public function data(Theme $theme, array $data): array
{
$photos = $this->photos(array_values(array_filter([$data['first_photo_id'] ?? null, $data['second_photo_id'] ?? null])))->keyBy('id');
return [
'eyebrow' => $data['eyebrow'] ?? null,
'heading' => $data['heading'] ?? null,
'text' => $data['text'] ?? null,
'first' => $photos->get((int) ($data['first_photo_id'] ?? 0)),
'second' => $photos->get((int) ($data['second_photo_id'] ?? 0)),
'firstLabel' => filled($data['first_label'] ?? null) ? $data['first_label'] : 'Sommer',
'secondLabel' => filled($data['second_label'] ?? null) ? $data['second_label'] : 'Winter',
];
}
}
+85
View File
@@ -0,0 +1,85 @@
<?php
namespace App\Themes\Sections;
use App\Themes\Theme;
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
/**
* Personal excursion tips as cards: photo and name in front, the host's tip, the way there and the best time
* on the back. Guests turn a card with a labelled button; without JavaScript both sides are shown.
*/
class TipsSection extends Section
{
public static function key(): string
{
return 'tips';
}
public static function label(): string
{
return 'Ausflugstipps (Karten zum Umdrehen)';
}
public static function icon(): string
{
return 'heroicon-o-sparkles';
}
public static function schema(): array
{
return [
TextInput::make('eyebrow')->label('Kleine Überschrift')->maxLength(100),
TextInput::make('heading')->label('Überschrift')->default('Unsere Tipps für Kühlungsborn')->maxLength(160),
Textarea::make('text')->label('Text')->rows(2)->maxLength(400),
TextInput::make('signature')
->label('Unterschrift')
->helperText('Steht unter jedem Tipp, z. B. „Brigitte“. Leer lassen für keine.')
->maxLength(60),
Repeater::make('tips')
->label('Tipps')
->addActionLabel('Tipp hinzufügen')
->helperText('Vier oder sechs Karten wirken am ruhigsten.')
->defaultItems(0)
->maxItems(9)
->collapsible()
->itemLabel(fn (array $state): ?string => $state['title'] ?? null)
->columns(2)
->schema([
TextInput::make('title')->label('Ziel')->placeholder('Gespensterwald')->required()->maxLength(80),
static::photoSelect('photo_id', 'Foto'),
Textarea::make('tip')
->label('Ihr Tipp (Rückseite)')
->placeholder('Am schönsten am späten Nachmittag, wenn die Sonne durch die Buchen fällt …')
->rows(3)
->required()
->maxLength(400)
->columnSpanFull(),
TextInput::make('way')->label('Weg dorthin')->placeholder('25 Minuten mit dem Rad')->maxLength(80),
TextInput::make('best_time')->label('Beste Zeit')->placeholder('Später Nachmittag')->maxLength(80),
]),
];
}
public function data(Theme $theme, array $data): array
{
$tips = collect($data['tips'] ?? [])->filter(fn (mixed $tip): bool => is_array($tip) && filled($tip['title'] ?? null) && filled($tip['tip'] ?? null));
$photos = $this->photos($tips->pluck('photo_id')->filter()->values()->all())->keyBy('id');
return [
'eyebrow' => $data['eyebrow'] ?? null,
'heading' => $data['heading'] ?? null,
'text' => $data['text'] ?? null,
'signature' => $data['signature'] ?? null,
'tips' => $tips->map(fn (array $tip): array => [
'title' => (string) $tip['title'],
'photo' => $photos->get((int) ($tip['photo_id'] ?? 0)),
'tip' => (string) $tip['tip'],
'way' => filled($tip['way'] ?? null) ? (string) $tip['way'] : null,
'bestTime' => filled($tip['best_time'] ?? null) ? (string) $tip['best_time'] : null,
])->values()->all(),
];
}
}
+1 -1
View File
@@ -40,7 +40,7 @@ class ThemeChecker
'@livewireStyles' => 'Buchungsformular braucht @livewireStyles.',
'@livewireScripts' => 'Buchungsformular braucht @livewireScripts.',
'noindex' => 'Vorschau und Testbetrieb müssen noindex setzen.',
'id="lightbox"' => 'Galerie-Lightbox fehlt (<dialog id="lightbox"> mit img, [data-caption], [data-close]).',
'partials.lightbox' => 'Galerie-Lightbox fehlt (@include(\'theme::partials.lightbox\') – ein eigenes partials/lightbox im Theme ist möglich).',
'data-appearance' => 'data-appearance am <html> fehlt (saisonale CSS-Regeln).',
],
'page' => [
+2
View File
@@ -42,6 +42,8 @@
Sections\FloorPlanSection::class,
Sections\TourSection::class,
Sections\LocationSection::class,
Sections\TipsSection::class,
Sections\CompareSection::class,
Sections\PricesSection::class,
Sections\OffersSection::class,
Sections\BookingSection::class,
+2
View File
@@ -4,6 +4,8 @@ # Projektstand
**Hauptadresse und Abspielgeschwindigkeit (30.10.2026):** Weitere Adressen einer Website (z. B. www.stommer.info) leiten jetzt dauerhaft (301, nur GET/HEAD) auf die Hauptadresse (`Site.domain`) um (`ResolveTheme::toMainAddress`). Vorher lud die Seite unter www Skripte, Schriften und Videos von der Adresse ohne www – der Browser blockierte sie als fremde Herkunft: kein JavaScript (Titelvideo, Menü-Pfeile), Ersatzschrift. `Site::origin()` nimmt verbindlich das Feld `domain`. Videos haben eine **Abspielgeschwindigkeit** (Webseite › Videos, 0,5×–1×), die überall gilt, wo das Video läuft.
**Design Stufe 2 – Tipp-Karten, Galerie, Sommer/Winter (30.10.2026, Branch `feature/design-stufe2`):** Neuer Baustein **„Ausflugstipps (Karten zum Umdrehen)“** (`tips`: Ziel, Foto, Tipp, Weg, beste Zeit, Unterschrift; Knopf „Tipp lesen“, per Tastatur bedienbar, verdeckte Seite `inert`, bei „Bewegung reduzieren“ Überblenden; Seebad: Ansichtskarten mit Briefmarke). Neuer Baustein **„Sommer/Winter-Vergleich“** (`compare`: zwei Fotos vom selben Standpunkt, Trennlinie ziehen oder tippen, Pfeiltasten über verstecktes Schieberegler-Feld; einmaliger kurzer Schwenk beim Hinscrollen; beide Fotos unabhängig vom Erscheinungsbild). **Galerie:** Das Foto wächst aus dem Vorschaubild und schrumpft beim Schließen zurück, Blättern mit Pfeilen, Pfeiltasten und Wischen, „3 von 20“, Bildunterschrift (`caption`) – Dialog jetzt `partials/lightbox` (von `themes:check` geprüft). Mechanik in theme-base.css/theme.js, beide Themes. Lokal mit Bildschirmfotos (Desktop/Handy, Bewegung reduziert) geprüft. Echte Winterfotos und Tipp-Texte fehlen noch – im Admin einpflegen.
**Titelvideo, Rundgang, freie Termine, Buchungsseite (30.10.2026, Branch `feature/titelvideo-rundgang`):** Neue Verwaltung **Webseite › Videos** (`Video`: Datei bis 100 MB, Standbild, Kapitel mit Raum aus dem Grundriss; Upload-Grenzen von Livewire/Medienbibliothek auf 100 MB angehoben – vorher scheiterten schon Fotos über 10 MB). **Titelbereich:** „Video statt Foto“ (stumme Schleife, lädt nur ohne „Bewegung reduzieren“/Save-Data, Pause-Knopf) und „Nächste freie Termine“ (`App\Availability\NextFreeStays`: bis zu 3 buchbare, nicht überlappende Zeiträume mit Gesamtpreis, 10 Min. zwischengespeichert, Klick füllt die Anfrage vor; Seebad: Fahrkarten). **Neuer Baustein „Rundgang (Video)“** (Anordnung wählbar: volle Breite/Video links/rechts; Kapitel als Fahrplan; lädt erst beim Start); Grundriss-Räume mit Kapitel bieten „Im Rundgang ansehen“. **Buchungsseite:** Preis links unter dem Kalender, Formular rechts (auf großen Bildschirmen mitlaufend) – keine halbleere Seite mehr; Ablauf „Anfrage → Angebot → Annahme“ als Grafik (abschaltbar). **Seebad:** Sonnenaufgang des Trenners einmal beim Hinscrollen statt unmerklicher Dauerbewegung. Aus dem Agenturvideo (41,7 MB, Rechte bei Stommers) geschnitten: Titelschleife „Garten und Meer“ (9 s, 3,5 MB) und Rundgang (58 s, 14,5 MB) – liegen nicht im Repo, Upload über den Admin. Lokal mit Bildschirmfotos (Desktop/Handy) geprüft. Tests: **526 Feature-Tests grün**, Pint, `themes:check` beide Themes.
**Erinnerungen und Zusammenfassungen einstellbar (30.10.2026, Branch `feature/erinnerungen-zusammenfassung`):** Neuer Abschnitt System › Betrieb › **Benachrichtigungen** (Spalten auf `tenants`). „Offene Meldungen erneut senden“: nur einmal (Vorgabe), täglich, alle 2/3 Tage, wöchentlich – gilt für mögliche Doppelbuchungen (solange im Postfach ungelesen und weiter festgestellt; Lesen beendet die Erinnerung, `Inbox::reminderDue`) und offene Portal-Aufgaben (`RemindChannelTasks`). **Tägliche und/oder wöchentliche Zusammenfassung** (`SendDigests`, Scheduler alle 15 Minuten, ab wählbarer Uhrzeit, Wochentag wählbar; am Wochentag nur die Wochenübersicht) mit wählbaren Teilen (`DigestSection`, `DigestReport`): Postfach, offene Anfragen/Angebote mit Frist, Neues seit der letzten Übersicht (Anfragen, Buchungen, Stornierungen, Portalbuchungen), An-/Abreisen (heute+morgen bzw. 7 Tage), überfällige Zahlungen, Portal-Aufgaben/zu prüfende Portal-Mails/Kalender-Klärungsfälle/Abgleichsfehler, Bewertungen zur Freigabe. Leere Übersichten entfallen (abschaltbar), Knopf „Zusammenfassung jetzt senden“. Vorgabe: täglich 7 Uhr an, wöchentlich aus. Tests: **520 Feature-Tests / 2725 Assertions grün**, Pint. Seite nicht im Browser angesehen.
+6 -2
View File
@@ -157,6 +157,8 @@ ## 5. Bausteine und Vorlagen
| `sections/gallery` | Bildergalerie mit Lightbox |
| `sections/amenities` | Ausstattung |
| `sections/location` | Lage & Umgebung |
| `sections/tips` | Ausflugstipps als Karten zum Umdrehen |
| `sections/compare` | Sommer/Winter-Vergleich mit Trennlinie |
| `sections/prices` | Preise & Saisons |
| `sections/offers` | Sonderangebote (nebeneinander / Liste / rollierend) |
| `sections/booking` | Kalender & Anfrage (Livewire) |
@@ -182,13 +184,15 @@ ## 6. Pflicht-Markup (wird von `themes:check` geprüft)
| Vorlage | Muss enthalten | Warum |
|---|---|---|
| `layouts/app` | `@vite($theme->assets())`, `{!! $theme->cssVariables() !!}` in `<style>`, `@livewireStyles`, `@livewireScripts`, `@stack('head')`, `@yield('content')`, `data-appearance="{{ $theme->appearanceKey() }}"` am `<html>`, `<meta name="robots" content="noindex">` wenn `$theme->isPreview \|\| ! app()->isProduction()`, Vorschau-Hinweis, `<dialog id="lightbox">` mit `img`, `[data-caption]`, `[data-close]`, Sprunglink `#inhalt` | Assets, Farben, Buchung, SEO-Schutz, Lightbox, Barrierefreiheit |
| `layouts/app` | `@vite($theme->assets())`, `{!! $theme->cssVariables() !!}` in `<style>`, `@livewireStyles`, `@livewireScripts`, `@stack('head')`, `@yield('content')`, `data-appearance="{{ $theme->appearanceKey() }}"` am `<html>`, `<meta name="robots" content="noindex">` wenn `$theme->isPreview \|\| ! app()->isProduction()`, Vorschau-Hinweis, `@include('theme::partials.lightbox')` (eigenes `partials/lightbox` möglich: `<dialog id="lightbox">` mit `img`, `[data-caption]`, `[data-counter]`, `[data-prev]`, `[data-next]`, `[data-close]`), Sprunglink `#inhalt` | Assets, Farben, Buchung, SEO-Schutz, Lightbox, Barrierefreiheit |
| `page` | Ausgabe von `$sections` (`{!! $section->render() !!}`) und JSON-LD aus `$structuredData` per `@push('head')` | Inhalt, Google |
| `partials/header` | `$theme->menu('main')` (Links `->url()`, Text `->label()`), Button zur Buchung | Navigation |
| `partials/footer` | `$theme->menu('footer')` (Impressum, Datenschutz) | Rechtspflicht |
| `sections/hero` | GET-Formular an `route('booking.create')` mit `data-availability-search` und Feldern `name="anreise"`, `name="abreise"` (Y-m-d), `name="personen"` | Suche → Buchungsseite |
| `sections/booking` | `<livewire:booking-request :property="$property" />` | Kalender, Preis, Anfrage |
| `sections/gallery` | Links `<a href="{{ $photo->url('lg') }}" data-lightbox data-alt="{{ $photo->alt_text }}">` | Lightbox |
| `sections/gallery` | Links `<a href="{{ $photo->url('lg') }}" data-lightbox data-alt="{{ $photo->alt_text }}" data-caption="{{ $photo->caption }}">` mit dem Vorschaubild als `<img>` darin (aus ihm wächst das große Foto) | Lightbox |
| `sections/tips` | `data-flip`, `data-flip-inner`, `data-flip-face="front\|back"`, Knöpfe `data-flip-toggle` (`hidden`, `aria-controls` der Rückseite) | Karten umdrehen (theme.js) |
| `sections/compare` | `data-compare` (zweites Foto darin), `data-compare-first`, `data-compare-handle`, `<input type="range" hidden data-compare-range>` | Trennlinie (theme.js) |
| `sections/offers` | Umsetzung von `$display`: bei `rotating` die Attribute `data-rotator` (Container), `data-rotator-slide` (je Angebot, außer dem ersten `hidden`), `data-rotator-prev`/`-next`, `data-rotator-dot="<index>"` mit `aria-selected` | rollierende Angebote (theme.js) |
| `sections/reviews` | Hinweis: „Bewertungen über unsere Webseite können nur Gäste mit einer Buchung bei uns abgeben …“ (Wortlaut sinngemäß, muss „nur Gäste“ enthalten) | § 5b UWG |
| `sections/faq` | FAQ-JSON-LD per `@push('head')` | Google |
+3 -1
View File
@@ -104,10 +104,12 @@ ## 5. Bausteinkatalog – Vertrag der Vorlagen
| `hero` | Titelbereich mit Suche | `$eyebrow`, `$title` (Text, `*Wort*` = Hervorhebung), `$text`, `$photo`, `$video` (`App\Models\Video`\|null: stumme Schleife statt des Fotos – `@include('theme::partials.video-loop', ['video' => $video, 'class' => …])`), `$freeStays` (Liste `arrival`, `departure` (CarbonImmutable), `nights`, `total` (Cent), `url` – `@include('theme::partials.free-stays')`), `$showSearch`, `$property`, `$featuredOffer` (`AdvertisedOffer`\|null: wichtigstes hervorgehobenes Angebot) – Suche als GET-Formular an `route('booking.create')` mit `anreise`, `abreise` (Y-m-d), `personen` |
| `facts` | Eckdaten | `$heading`, `$property`, `$highlights` (Collection<string>), `$fromPrice` (Cent\|null) |
| `text_image` | Text mit Bildern | `$eyebrow`, `$heading`, `$text` (HtmlString\|null), `$photos` (≤3), `$imagePosition` (`left`\|`right`), `$linkLabel`, `$linkUrl` |
| `gallery` | Bildergalerie | `$heading`, `$photos` – Lightbox: `<a href="{{ $photo->url('lg') }}" data-lightbox data-alt="…">` |
| `gallery` | Bildergalerie | `$heading`, `$photos` – Lightbox: `<a href="{{ $photo->url('lg') }}" data-lightbox data-alt="…" data-caption="{{ $photo->caption }}">` mit Vorschau-`<img>`. Das Foto wächst aus der Vorschau und schrumpft beim Schließen zurück; die Links eines Abschnitts bilden eine Reihe (Pfeile, Pfeiltasten, Wischen, „3 von 12“). Dialog: `partials/lightbox` |
| `amenities` | Ausstattung | `$heading`, `$groups` (Bereich ⇒ Collection<Amenity>) |
| `floor_plan` | Grundriss (interaktiv) | `$heading`, `$text`, `$photo` (Grundriss-Bild, `Photo`), `$rooms` (Collection von Arrays: `key` – Anker-ID, `name`, `description`, `hint` – Barrierefreiheit, `points` – „x,y x,y …“ in **Prozent** des Bildes → SVG `viewBox="0 0 100 100" preserveAspectRatio="none"` über dem Bild, `photos` – Collection<Photo>, `amenities` – Collection<string>). `videoChapter` – Kapitel eines Rundgang-Videos mit diesem Raum: `seconds`, `time`, `label` oder null → Link `<a href="#" hidden data-tour-link="{{ seconds }}">`, den theme.js nur zeigt, wenn ein Rundgang auf derselben Seite ist). Rendert nichts ohne Bild oder Räume. Daten: Admin › Webseite › Grundriss (`FloorPlan`) |
| `tour` | Rundgang (Video) | `$eyebrow`, `$heading`, `$text`, `$video` (`Video`\|null – ohne Video rendert nichts), `$chapters` (Liste `seconds`, `time` „0:16“, `label`, `room`), `$layout` (`wide`\|`left`\|`right`). Pflicht-Markup für theme.js: `data-tour` am Abschnitt, `<video controls preload="none">` (lädt erst beim Start), `[data-tour-start]` (Start-Overlay, `hidden`), `[data-tour-chapters]` (`hidden`, ohne JS unsichtbar), `[data-tour-seek="<Sekunden>"]` je Kapitel (aktuelles bekommt `aria-current="true"`). Daten: Admin › Webseite › Videos |
| `tips` | Ausflugstipps (Karten zum Umdrehen) | `$eyebrow`, `$heading`, `$text`, `$signature` (z. B. „Brigitte“ oder null), `$tips` (Liste `title`, `photo` – `Photo`\|null, `tip`, `way`, `bestTime`). Pflicht-Markup für theme.js: `[data-flip]` je Karte > `[data-flip-inner]` > `[data-flip-face="front"]` und `[data-flip-face="back"]` (mit `id`), Knöpfe `[data-flip-toggle]` (`hidden`, `aria-controls`). Ohne JS stehen beide Seiten untereinander; die verdeckte Seite ist `inert`; mit „Bewegung reduzieren“ wird überblendet (Mechanik in theme-base.css) |
| `compare` | Sommer/Winter-Vergleich | `$eyebrow`, `$heading`, `$text`, `$first`, `$second` (`Photo`\|null, beide unabhängig vom Erscheinungsbild – ohne beide rendert nichts), `$firstLabel`, `$secondLabel`. Pflicht-Markup: `[data-compare]` (Seitenverhältnis, darin das zweite Foto), `[data-compare-first]` (erstes Foto, bis `--split` sichtbar), `[data-compare-handle]`, `<input type="range" min="0" max="100" hidden data-compare-range class="sr-only">` für Tastatur und Screenreader. theme.js: Ziehen/Tippen, einmaliger kurzer Schwenk beim Hinscrollen (nicht bei „Bewegung reduzieren“) |
| `location` | Lage & Umgebung | `$eyebrow`, `$heading`, `$text`, `$address`, `$mapUrl` (OpenStreetMap-Link, keine eingebettete Karte), `$photos` |
| `prices` | Preise & Saisons | `$eyebrow`, `$heading`, `$text`, `$property`, `$seasons` (nächste 12 Monate), `$extras`, `$featuredSeason` (Name des Erscheinungsbilds) |
| `offers` | Sonderangebote | `$heading`, `$display` (`grid`\|`list`\|`rotating`), `$offers` (Collection<`App\Pricing\AdvertisedOffer`>: `title`, `description`, `advantage`, `conditions`, `arrival`/`departure`/`nights()` bei festen Terminen und Lücken, `quote` + `regularTotal()` für „statt …“, `bookingUrl()`). Rollierend: `data-rotator`, `data-rotator-slide`, `data-rotator-prev/next/dot` (theme.js) |
@@ -120,6 +120,104 @@ @layer components {
}
}
/*
* Cards to turn over (sections/tips). Without JavaScript both faces stand one below the other; theme.js sets
* data-flip="ready", stacks the faces in one grid cell (the card takes the height of the taller face) and toggles
* data-flipped. With "reduce motion" the faces cross-fade instead of turning.
*/
[data-flip='ready'] {
perspective: 1800px;
}
[data-flip='ready'] > [data-flip-inner] {
display: grid;
height: 100%;
transform-style: preserve-3d;
transition: transform 0.8s cubic-bezier(0.3, 0.7, 0.2, 1);
}
[data-flip='ready'] [data-flip-face] {
grid-area: 1 / 1;
backface-visibility: hidden;
-webkit-backface-visibility: hidden;
}
[data-flip='ready'] [data-flip-face='back'] {
transform: rotateY(180deg);
}
[data-flip='ready'][data-flipped] > [data-flip-inner] {
transform: rotateY(180deg);
}
@media (prefers-reduced-motion: reduce) {
[data-flip='ready'] > [data-flip-inner],
[data-flip='ready'][data-flipped] > [data-flip-inner],
[data-flip='ready'] [data-flip-face='back'] {
transform: none;
}
[data-flip='ready'] [data-flip-face] {
transition: opacity 0.3s;
}
[data-flip='ready'] [data-flip-face='back'],
[data-flip='ready'][data-flipped] [data-flip-face='front'] {
opacity: 0;
}
[data-flip='ready'][data-flipped] [data-flip-face='back'] {
opacity: 1;
}
}
/*
* Two photos with a dividing line (sections/compare): --split is the share of the first photo. theme.js moves it by
* dragging or tapping; the visually hidden range input does the same by keyboard and screen reader.
*/
[data-compare] {
--split: 50%;
position: relative;
touch-action: pan-y;
user-select: none;
}
[data-compare] img {
pointer-events: none;
}
[data-compare-first] {
position: absolute;
inset: 0;
clip-path: inset(0 calc(100% - var(--split)) 0 0);
}
[data-compare-handle] {
position: absolute;
top: 0;
bottom: 0;
left: var(--split);
translate: -50% 0;
}
[data-compare]:has(input:focus-visible) [data-compare-handle] {
outline: 3px solid var(--accent);
outline-offset: 3px;
}
/* Lightbox (layout dialog#lightbox): the backdrop fades; the photo's way out of the gallery is animated in theme.js. */
@media (prefers-reduced-motion: no-preference) {
#lightbox[open]::backdrop {
animation: lightbox-fade 0.35s ease-out;
}
@keyframes lightbox-fade {
from {
opacity: 0;
}
}
}
/* Gentle reveal while scrolling – only where supported and only without "reduce motion". */
@media (prefers-reduced-motion: no-preference) {
@supports (animation-timeline: view()) {
+209 -23
View File
@@ -2,32 +2,137 @@
* Theme "Ostsee-Licht": small progressive enhancements. Everything works without JavaScript.
*/
// Lightbox for galleries: links with data-lightbox open the large image in a <dialog>.
document.addEventListener('click', (event) => {
const link = event.target.closest('a[data-lightbox]');
if (!link) {
return;
}
// Lightbox for galleries: links with data-lightbox open the large image in the layout's dialog#lightbox. The photo
// grows out of its thumbnail and shrinks back on closing; the links of one section form a series to browse with the
// arrow buttons, the arrow keys or a swipe. Without JavaScript the link simply opens the large image.
const lightbox = document.getElementById('lightbox');
if (lightbox && typeof lightbox.showModal === 'function') {
const image = lightbox.querySelector('img');
const caption = lightbox.querySelector('[data-caption]');
const counter = lightbox.querySelector('[data-counter]');
const browseButtons = lightbox.querySelectorAll('[data-prev], [data-next]');
const ease = 'cubic-bezier(0.2, 0.8, 0.2, 1)';
let series = [];
let index = 0;
const dialog = document.getElementById('lightbox');
if (!dialog || typeof dialog.showModal !== 'function') {
return;
}
const thumbnailOf = (link) => link.querySelector('img');
event.preventDefault();
const image = dialog.querySelector('img');
image.src = link.href;
image.alt = link.dataset.alt ?? '';
dialog.querySelector('[data-caption]').textContent = link.dataset.alt ?? '';
dialog.showModal();
});
// Transform that lays the opened image over the thumbnail: same centre, scaled to cover it, cropped like object-cover.
const fromThumbnail = (thumbnail) => {
const from = thumbnail.getBoundingClientRect();
const to = image.getBoundingClientRect();
if (!from.width || !to.width) {
return null;
}
const scale = Math.max(from.width / to.width, from.height / to.height);
const insetX = (to.width * scale - from.width) / (2 * scale);
const insetY = (to.height * scale - from.height) / (2 * scale);
const x = from.left + from.width / 2 - (to.left + to.width / 2);
const y = from.top + from.height / 2 - (to.top + to.height / 2);
document.addEventListener('click', (event) => {
const dialog = event.target.closest('dialog#lightbox');
if (dialog && (event.target === dialog || event.target.closest('[data-close]'))) {
dialog.close();
}
});
return { transform: `translate(${x}px, ${y}px) scale(${scale})`, clipPath: `inset(${insetY}px ${insetX}px round 4px)` };
};
const visible = (element) => {
const rect = element.getBoundingClientRect();
return rect.bottom > 0 && rect.top < window.innerHeight && rect.width > 0;
};
const show = (position) => {
index = (position + series.length) % series.length;
const link = series[index];
const thumbnail = thumbnailOf(link);
image.src = thumbnail?.currentSrc || link.href;
image.alt = link.dataset.alt ?? '';
caption.textContent = link.dataset.caption || link.dataset.alt || '';
if (counter) {
counter.textContent = series.length > 1 ? `${index + 1} von ${series.length}` : '';
}
if (image.src !== link.href) {
const large = new Image();
large.onload = () => { if (series[index] === link) image.src = link.href; };
large.src = link.href;
}
};
const browse = (step) => {
if (series.length < 2) {
return;
}
show(index + step);
if (!reducedMotion()) {
image.animate([{ opacity: 0, transform: `translateX(${step * 2.5}rem)` }, { opacity: 1, transform: 'none' }], { duration: 320, easing: ease });
}
};
const close = () => {
const thumbnail = thumbnailOf(series[index] ?? lightbox);
const start = !reducedMotion() && thumbnail && visible(thumbnail) ? fromThumbnail(thumbnail) : null;
if (!start) {
lightbox.close();
return;
}
lightbox.querySelectorAll('[data-chrome]').forEach((element) => element.animate([{ opacity: 1 }, { opacity: 0 }], { duration: 150, fill: 'forwards' }));
image.animate([{ transform: 'none', clipPath: 'inset(0 0 round 4px)' }, start], { duration: 380, easing: ease, fill: 'forwards' })
.finished.then(() => {
lightbox.close();
lightbox.getAnimations({ subtree: true }).forEach((animation) => animation.cancel());
});
};
document.addEventListener('click', (event) => {
const link = event.target.closest('a[data-lightbox]');
if (!link) {
return;
}
event.preventDefault();
series = [...(link.closest('section') ?? document).querySelectorAll('a[data-lightbox]')];
browseButtons.forEach((button) => { button.hidden = series.length < 2; });
show(series.indexOf(link));
lightbox.showModal();
const thumbnail = thumbnailOf(link);
const start = !reducedMotion() && thumbnail ? fromThumbnail(thumbnail) : null;
if (start) {
image.animate([start, { transform: 'none', clipPath: 'inset(0 0 round 4px)' }], { duration: 480, easing: ease });
lightbox.querySelectorAll('[data-chrome]').forEach((element) => element.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 250, delay: 300, fill: 'backwards' }));
}
});
lightbox.addEventListener('click', (event) => {
if (event.target.closest('[data-prev]')) {
browse(-1);
} else if (event.target.closest('[data-next]')) {
browse(1);
} else if (event.target === lightbox || event.target.closest('[data-close]')) {
close();
}
});
lightbox.addEventListener('cancel', (event) => {
event.preventDefault();
close();
});
lightbox.addEventListener('keydown', (event) => {
if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {
event.preventDefault();
browse(event.key === 'ArrowLeft' ? -1 : 1);
}
});
let swipeStart = null;
lightbox.addEventListener('pointerdown', (event) => { swipeStart = { x: event.clientX, y: event.clientY }; });
lightbox.addEventListener('pointerup', (event) => {
const dx = swipeStart ? event.clientX - swipeStart.x : 0;
const dy = swipeStart ? event.clientY - swipeStart.y : 0;
swipeStart = null;
if (Math.abs(dx) > 50 && Math.abs(dx) > Math.abs(dy) * 1.5) {
browse(dx < 0 ? 1 : -1);
}
});
}
// Availability search in the hero: forwards the dates to the booking page.
document.addEventListener('submit', (event) => {
@@ -171,3 +276,84 @@ if (!reducedMotion() && 'IntersectionObserver' in window) {
reveal.observe(element);
});
}
// Cards to turn over (sections/tips): [data-flip] card, [data-flip-inner], [data-flip-face="front|back"], buttons
// [data-flip-toggle] (hidden without JavaScript). The hidden face is inert, so keyboard and screen reader stay on the
// visible one; focus moves to the button of the face that turns up.
document.querySelectorAll('[data-flip]').forEach((card) => {
const front = card.querySelector('[data-flip-face="front"]');
const back = card.querySelector('[data-flip-face="back"]');
const turn = (flipped) => {
card.toggleAttribute('data-flipped', flipped);
front.inert = flipped;
back.inert = !flipped;
card.querySelectorAll('[data-flip-toggle]').forEach((button) => button.setAttribute('aria-expanded', String(flipped)));
(flipped ? back : front).querySelector('[data-flip-toggle]')?.focus({ preventScroll: true });
};
card.dataset.flip = 'ready';
back.inert = true;
card.querySelectorAll('[data-flip-toggle]').forEach((button) => {
button.hidden = false;
button.addEventListener('click', () => turn(!card.hasAttribute('data-flipped')));
});
});
// Season comparison (sections/compare): dragging or tapping moves the dividing line, the hidden range input
// ([data-compare-range]) does the same by keyboard. Once in view, the line sweeps briefly to show it can be moved.
document.querySelectorAll('[data-compare]').forEach((box) => {
const range = box.querySelector('[data-compare-range]');
let touched = false;
const set = (percent) => {
const value = Math.min(100, Math.max(0, percent));
box.style.setProperty('--split', `${value}%`);
range.value = String(Math.round(value));
};
const fromPointer = (event) => {
const rect = box.getBoundingClientRect();
set(((event.clientX - rect.left) / rect.width) * 100);
};
range.hidden = false;
range.addEventListener('input', () => { touched = true; set(Number(range.value)); });
box.addEventListener('pointerdown', (event) => {
touched = true;
box.setPointerCapture(event.pointerId);
fromPointer(event);
});
box.addEventListener('pointermove', (event) => {
if (box.hasPointerCapture(event.pointerId)) {
fromPointer(event);
}
});
if (reducedMotion() || !('IntersectionObserver' in window)) {
return;
}
const hint = new IntersectionObserver(([entry]) => {
if (!entry.isIntersecting) {
return;
}
hint.disconnect();
const keys = [[0, 50], [0.35, 68], [0.75, 34], [1, 50]];
const duration = 2200;
let begin = null;
const step = (time) => {
if (touched) {
return;
}
begin ??= time;
const t = Math.min(1, (time - begin) / duration);
const k = keys.findIndex(([at]) => at >= t);
const [t0, v0] = keys[Math.max(0, k - 1)];
const [t1, v1] = keys[k];
const local = t1 === t0 ? 1 : (t - t0) / (t1 - t0);
set(v0 + (v1 - v0) * (0.5 - Math.cos(Math.PI * local) / 2));
if (t < 1) {
requestAnimationFrame(step);
}
};
setTimeout(() => requestAnimationFrame(step), 400);
}, { threshold: 0.6 });
hint.observe(box);
});
@@ -48,13 +48,7 @@
@include('theme::partials.footer')
@include('theme::partials.mobile-booking-bar')
<dialog id="lightbox" class="m-auto max-h-[92vh] max-w-[92vw] bg-transparent p-0 backdrop:bg-black/80" aria-label="Bild vergrößert">
<figure class="relative">
<img src="" alt="" class="max-h-[85vh] max-w-[92vw] object-contain">
<figcaption data-caption class="mt-2 text-center text-sm text-white"></figcaption>
<button type="button" data-close class="absolute top-2 right-2 rounded-full bg-black/60 px-3 py-1 text-white" aria-label="Schließen">✕</button>
</figure>
</dialog>
@include('theme::partials.lightbox')
@livewireScripts
</body>
@@ -0,0 +1,23 @@
{{--
Lightbox dialog for all a[data-lightbox] links (theme.js): img, [data-caption], [data-counter], [data-prev]/[data-next]
(hidden for a single photo), [data-close]. Elements with [data-chrome] fade in after the photo has grown out of its
thumbnail. Links may set data-caption (shown below) besides data-alt (alternative text).
--}}
<dialog id="lightbox" class="m-auto max-h-[94vh] max-w-[94vw] overflow-visible bg-transparent p-0 backdrop:bg-black/85" aria-label="Bild vergrößert">
<figure class="relative">
<img src="" alt="" class="max-h-[84vh] max-w-[94vw] rounded object-contain">
<button type="button" data-prev data-chrome hidden class="absolute top-1/2 left-2 flex size-12 -translate-y-1/2 items-center justify-center rounded-full bg-black/60 text-white hover:bg-black/80" aria-label="Vorheriges Foto">
<x-heroicon-o-chevron-left class="size-6" aria-hidden="true" />
</button>
<button type="button" data-next data-chrome hidden class="absolute top-1/2 right-2 flex size-12 -translate-y-1/2 items-center justify-center rounded-full bg-black/60 text-white hover:bg-black/80" aria-label="Nächstes Foto">
<x-heroicon-o-chevron-right class="size-6" aria-hidden="true" />
</button>
<figcaption data-chrome class="mt-3 flex flex-wrap items-baseline justify-between gap-x-6 gap-y-1 px-1 text-base text-white">
<span data-caption></span>
<span data-counter class="text-white/70 tabular-nums"></span>
</figcaption>
<button type="button" data-close data-chrome class="absolute top-2 right-2 flex size-12 items-center justify-center rounded-full bg-black/60 text-white hover:bg-black/80" aria-label="Schließen">
<x-heroicon-o-x-mark class="size-6" aria-hidden="true" />
</button>
</figure>
</dialog>
@@ -0,0 +1,27 @@
{{--
Contract: $eyebrow, $heading, $text, $first, $second (Photo|null – renders nothing without both), $firstLabel, $secondLabel.
theme.js: [data-compare] box with the second photo underneath, [data-compare-first] (first photo, clipped at --split),
[data-compare-handle] (the line) and [data-compare-range] (range input 0–100, hidden without JavaScript).
--}}
@if ($first && $second)
<section class="mx-auto max-w-6xl px-4 py-16 sm:px-8" @if ($heading) aria-labelledby="{{ $sectionId }}-title" @else aria-label="{{ $firstLabel }} und {{ $secondLabel }}" @endif>
@if ($eyebrow)<p class="eyebrow">{{ $eyebrow }}</p>@endif
@if ($heading)<h2 id="{{ $sectionId }}-title" class="heading-display">{{ $heading }}</h2>@endif
@if ($text)<p class="mt-4 max-w-[60ch] text-muted">{{ $text }}</p>@endif
<div data-compare class="mt-8 aspect-[3/2] cursor-ew-resize overflow-hidden rounded bg-surface">
@include('theme::partials.image', ['photo' => $second, 'sizes' => '(min-width: 1152px) 72rem, 100vw', 'class' => 'absolute inset-0 h-full w-full object-cover'])
<div data-compare-first>
@include('theme::partials.image', ['photo' => $first, 'sizes' => '(min-width: 1152px) 72rem, 100vw', 'class' => 'h-full w-full object-cover'])
</div>
<span class="absolute top-4 left-4 rounded-full bg-ink/75 px-4 py-1.5 font-semibold text-ground">{{ $firstLabel }}</span>
<span class="absolute top-4 right-4 rounded-full bg-ink/75 px-4 py-1.5 font-semibold text-ground">{{ $secondLabel }}</span>
<div data-compare-handle class="w-1 bg-ground" aria-hidden="true">
<span class="absolute top-1/2 left-1/2 flex size-12 -translate-1/2 items-center justify-center rounded-full bg-ground text-ink shadow-lg">
<x-heroicon-o-arrows-right-left class="size-6" />
</span>
</div>
<input type="range" min="0" max="100" value="50" hidden data-compare-range class="sr-only" aria-label="Trennlinie zwischen {{ $firstLabel }} und {{ $secondLabel }} verschieben">
</div>
</section>
@endif
@@ -4,7 +4,7 @@
<ul class="grid grid-cols-2 gap-3 sm:gap-4 lg:grid-cols-4">
@foreach ($photos as $index => $photo)
<li @class(['reveal', 'col-span-2 row-span-2' => $index === 0])>
<a href="{{ $photo->url('lg') }}" data-lightbox data-alt="{{ $photo->alt_text }}" class="group block overflow-hidden rounded-sm">
<a href="{{ $photo->url('lg') }}" data-lightbox data-alt="{{ $photo->alt_text }}" data-caption="{{ $photo->caption }}" class="group block overflow-hidden rounded-sm">
@include('theme::partials.image', [
'photo' => $photo,
'sizes' => $index === 0 ? '(min-width: 1024px) 50vw, 100vw' : '(min-width: 1024px) 25vw, 50vw',
@@ -0,0 +1,41 @@
{{--
Contract: $eyebrow, $heading, $text, $signature (string|null), $tips (list: title, photo (Photo|null), tip, way, bestTime).
theme.js: each card [data-flip] > [data-flip-inner] > [data-flip-face="front"] + [data-flip-face="back"], buttons
[data-flip-toggle] with aria-controls of the back (hidden without JavaScript – then both faces are shown).
--}}
@if ($tips !== [])
<section class="mx-auto max-w-7xl px-4 py-16 sm:px-8" @if ($heading) aria-labelledby="{{ $sectionId }}-title" @else aria-label="Ausflugstipps" @endif>
@if ($eyebrow)<p class="eyebrow">{{ $eyebrow }}</p>@endif
@if ($heading)<h2 id="{{ $sectionId }}-title" class="heading-display">{{ $heading }}</h2>@endif
@if ($text)<p class="mt-4 max-w-[60ch] text-muted">{{ $text }}</p>@endif
<ul class="mt-10 grid gap-6 sm:grid-cols-2 lg:grid-cols-3">
@foreach ($tips as $tip)
@php($backId = $sectionId.'-tip-'.$loop->index)
<li data-flip>
<div data-flip-inner>
<div data-flip-face="front" class="flex flex-col overflow-hidden rounded bg-surface">
@include('theme::partials.image', ['photo' => $tip['photo'], 'sizes' => '(min-width: 1024px) 30vw, (min-width: 640px) 45vw, 100vw', 'class' => 'aspect-[4/3] w-full object-cover'])
<div class="flex flex-1 items-center justify-between gap-4 p-5">
<h3 class="font-display text-2xl leading-tight">{{ $tip['title'] }}</h3>
<button type="button" hidden data-flip-toggle aria-expanded="false" aria-controls="{{ $backId }}" class="btn-primary shrink-0">Tipp lesen</button>
</div>
</div>
<div data-flip-face="back" id="{{ $backId }}" class="flex flex-col gap-4 rounded border border-line bg-surface p-6">
<p class="font-display text-2xl leading-tight">{{ $tip['title'] }}</p>
<p class="text-lg leading-relaxed">{{ $tip['tip'] }}</p>
@if ($signature)<p class="font-display text-xl text-accent italic">{{ $signature }}</p>@endif
@if ($tip['way'] || $tip['bestTime'])
<dl class="mt-auto grid gap-2 border-t border-line pt-4 text-muted">
@if ($tip['way'])<div class="flex gap-3"><dt><x-heroicon-o-map class="size-5" aria-hidden="true" /><span class="sr-only">Weg</span></dt><dd>{{ $tip['way'] }}</dd></div>@endif
@if ($tip['bestTime'])<div class="flex gap-3"><dt><x-heroicon-o-clock class="size-5" aria-hidden="true" /><span class="sr-only">Beste Zeit</span></dt><dd>{{ $tip['bestTime'] }}</dd></div>@endif
</dl>
@endif
<button type="button" hidden data-flip-toggle aria-expanded="false" aria-controls="{{ $backId }}" class="self-start font-semibold text-accent underline underline-offset-4">Zurück zum Foto</button>
</div>
</div>
</li>
@endforeach
</ul>
</section>
@endif
+27
View File
@@ -132,6 +132,33 @@ @layer components {
@apply font-semibold text-accent;
}
/*
* Ansichtskarte (Ausflugstipps): weißer Bildrand, feiner Schatten, leicht gegeneinander verdreht wie auf dem
* Tisch ausgelegt; gerade, sobald man sie anfasst oder umdreht. Rückseite mit Briefmarke (gezähnter Rand).
*/
.postcard {
@apply h-full bg-surface shadow-[0_1px_2px_rgb(19_41_75/0.12),0_12px_28px_-14px_rgb(19_41_75/0.4)];
}
.postcard-tilt {
@apply transition-[rotate] duration-500 sm:odd:-rotate-[0.8deg] sm:even:rotate-[0.6deg] sm:hover:rotate-0;
}
.postcard-tilt[data-flipped] {
@apply rotate-0;
}
.stamp {
@apply block size-[4.5rem] shrink-0 bg-ground p-2.5 text-ink;
mask: linear-gradient(#000 0 0) content-box, radial-gradient(circle 0.2rem, #0000 95%, #000) -0.3rem -0.3rem / 0.6rem 0.6rem round;
box-shadow: inset 0 0 0 0.375rem var(--surface), inset 0 0 0 0.5rem var(--brand-reed);
}
/* Sommer/Winter-Vergleich: Knauf auf der Trennlinie. */
.compare-knob {
@apply absolute top-1/2 left-1/2 flex size-14 -translate-1/2 items-center justify-center rounded-full border-2 border-ink bg-surface text-ink shadow-lg;
}
/* Kartusche: Doppelrahmen, Rundbogengaube als Kopf, Kopfbänder der Terrassen als Eckkonsolen. */
.cartouche {
@apply relative border-2 border-ink bg-surface outline outline-1 -outline-offset-[10px] outline-[var(--brand-reed)];
@@ -48,13 +48,7 @@
@include('theme::partials.footer')
@include('theme::partials.mobile-booking-bar')
<dialog id="lightbox" class="m-auto max-h-[92vh] max-w-[92vw] bg-transparent p-0 backdrop:bg-black/80" aria-label="Bild vergrößert">
<figure class="relative">
<img src="" alt="" class="max-h-[85vh] max-w-[92vw] object-contain">
<figcaption data-caption class="mt-2 text-center text-base text-white"></figcaption>
<button type="button" data-close class="absolute top-2 right-2 min-h-11 min-w-11 rounded-full bg-black/60 px-3 text-white" aria-label="Schließen">✕</button>
</figure>
</dialog>
@include('theme::partials.lightbox')
@livewireScripts
</body>
@@ -0,0 +1,37 @@
{{--
Contract: see ostsee-licht/views/sections/compare.blade.php. Seebad: heading and text above, the photos in the
double frame of the house (as the tour), the labels below the frame at both ends, so they never cover the view.
--}}
@if ($first && $second)
<section class="mx-auto max-w-6xl px-4 py-14 sm:px-8 sm:py-20" @if ($heading) aria-labelledby="{{ $sectionId }}-title" @else aria-label="{{ $firstLabel }} und {{ $secondLabel }}" @endif>
<div class="flex flex-wrap items-end gap-x-14 gap-y-4">
<div class="min-w-0 flex-[1_1_24rem]">
@if ($eyebrow)<p class="eyebrow">{{ $eyebrow }}</p>@endif
@if ($heading)<h2 id="{{ $sectionId }}-title" class="heading-display">{{ $heading }}</h2>@endif
</div>
@if ($text)<p class="min-w-0 max-w-[52ch] flex-[1_1_22rem] text-muted">{{ $text }}</p>@endif
</div>
<figure class="mt-10">
<div class="relative border-2 border-ink bg-surface p-2.5 sm:p-3.5">
<span class="absolute -top-0.5 -left-0.5 z-10" aria-hidden="true">@include('theme::partials.motif', ['slot' => 'bracket', 'class' => 'size-10'])</span>
<span class="absolute -top-0.5 -right-0.5 z-10 -scale-x-100" aria-hidden="true">@include('theme::partials.motif', ['slot' => 'bracket', 'class' => 'size-10'])</span>
<div data-compare class="aspect-[4/3] cursor-ew-resize overflow-hidden bg-ink sm:aspect-[3/2]">
@include('theme::partials.image', ['photo' => $second, 'sizes' => '(min-width: 1152px) 70rem, 100vw', 'class' => 'absolute inset-0 h-full w-full object-cover'])
<div data-compare-first>
@include('theme::partials.image', ['photo' => $first, 'sizes' => '(min-width: 1152px) 70rem, 100vw', 'class' => 'h-full w-full object-cover'])
</div>
<div data-compare-handle class="w-[3px] bg-surface shadow-[0_0_0_1px_rgb(19_41_75/0.35)]" aria-hidden="true">
<span class="compare-knob"><x-heroicon-o-chevron-left class="size-5" /><x-heroicon-o-chevron-right class="-ml-1 size-5" /></span>
</div>
<input type="range" min="0" max="100" value="50" hidden data-compare-range class="sr-only" aria-label="Trennlinie zwischen {{ $firstLabel }} und {{ $secondLabel }} verschieben">
</div>
</div>
<figcaption class="mt-3 flex items-baseline justify-between gap-6 font-display text-[1.5rem] leading-tight">
<span class="flex items-center gap-2"><x-heroicon-o-arrow-long-left class="size-6 text-accent" aria-hidden="true" />{{ $firstLabel }}</span>
<span class="hidden text-base text-muted sm:inline" aria-hidden="true">Linie ziehen zum Vergleichen</span>
<span class="flex items-center gap-2">{{ $secondLabel }}<x-heroicon-o-arrow-long-right class="size-6 text-accent" aria-hidden="true" /></span>
</figcaption>
</figure>
</section>
@endif
@@ -7,7 +7,7 @@
<ul class="grid auto-rows-[9.5rem] grid-cols-2 gap-3 sm:auto-rows-[12rem] sm:gap-4 lg:grid-cols-4">
@foreach ($photos as $index => $photo)
<li @class(['reveal', 'col-span-2 row-span-2' => $index === 0, 'lg:row-span-2' => $index === 5])>
<a href="{{ $photo->url('lg') }}" data-lightbox data-alt="{{ $photo->alt_text }}" class="group relative block h-full overflow-hidden rounded">
<a href="{{ $photo->url('lg') }}" data-lightbox data-alt="{{ $photo->alt_text }}" data-caption="{{ $photo->caption }}" class="group relative block h-full overflow-hidden rounded">
@include('theme::partials.image', [
'photo' => $photo,
'sizes' => $index === 0 ? '(min-width: 1024px) 50vw, 100vw' : '(min-width: 1024px) 25vw, 50vw',
@@ -0,0 +1,57 @@
{{--
Contract: see ostsee-licht/views/sections/tips.blade.php. Seebad: every tip is a picture postcard of the seaside
resort – in front the photo with its white margin and the name, on the back the host's handwritten-looking
tip on the left, stamp and "address lines" (way there, best time) on the right of the dividing line.
--}}
@if ($tips !== [])
<section class="mx-auto max-w-7xl px-4 py-16 sm:px-8 sm:py-20" @if ($heading) aria-labelledby="{{ $sectionId }}-title" @else aria-label="Ausflugstipps" @endif>
<div class="flex flex-wrap items-end gap-x-14 gap-y-4">
<div class="min-w-0 flex-[1_1_26rem]">
@if ($eyebrow)<p class="eyebrow">{{ $eyebrow }}</p>@endif
@if ($heading)<h2 id="{{ $sectionId }}-title" class="heading-display">{{ $heading }}</h2>@endif
</div>
@if ($text)<p class="min-w-0 max-w-[52ch] flex-[1_1_22rem] text-muted">{{ $text }}</p>@endif
</div>
<ul class="mt-10 grid gap-x-8 gap-y-10 sm:grid-cols-2 lg:grid-cols-3">
@foreach ($tips as $tip)
@php($backId = $sectionId.'-tip-'.$loop->index)
<li data-flip class="postcard-tilt">
<div data-flip-inner>
<div data-flip-face="front" class="postcard flex flex-col p-3">
@include('theme::partials.image', ['photo' => $tip['photo'], 'sizes' => '(min-width: 1024px) 30vw, (min-width: 640px) 45vw, 100vw', 'class' => 'aspect-[3/2] w-full object-cover'])
<div class="flex flex-1 flex-wrap items-center justify-between gap-x-4 gap-y-3 px-1 pt-4 pb-1">
<h3 class="font-display text-[1.75rem] leading-tight">{{ $tip['title'] }}</h3>
<button type="button" hidden data-flip-toggle aria-expanded="false" aria-controls="{{ $backId }}" class="btn-outline min-h-11 shrink-0 px-4 py-2">
<x-heroicon-o-arrow-path-rounded-square class="mr-2 size-5" aria-hidden="true" />Tipp lesen
</button>
</div>
</div>
<div data-flip-face="back" id="{{ $backId }}" class="postcard grid grid-cols-[minmax(0,3fr)_minmax(0,2fr)] gap-x-5 p-5 sm:p-6">
<div class="flex min-w-0 flex-col gap-3 border-r border-line pr-5">
<p class="font-display text-[1.375rem] leading-snug italic">{{ $tip['tip'] }}</p>
@if ($signature)<p class="mt-auto font-display text-[1.375rem] text-accent italic">{{ $signature }}</p>@endif
</div>
<div class="flex min-w-0 flex-col">
<span class="stamp ml-auto" aria-hidden="true">@include('theme::partials.motif', ['slot' => 'crest', 'class' => 'size-full'])</span>
<p class="mt-4 font-display text-xl leading-tight break-words hyphens-auto">{{ $tip['title'] }}</p>
<dl class="mt-2 text-base">
@if ($tip['way'])
<div class="border-b border-line py-1.5"><dt class="text-sm text-muted">Weg</dt><dd>{{ $tip['way'] }}</dd></div>
@endif
@if ($tip['bestTime'])
<div class="border-b border-line py-1.5"><dt class="text-sm text-muted">Beste Zeit</dt><dd>{{ $tip['bestTime'] }}</dd></div>
@endif
</dl>
<button type="button" hidden data-flip-toggle aria-expanded="false" aria-controls="{{ $backId }}" class="mt-auto inline-flex min-h-11 items-center gap-2 self-start pt-4 font-semibold text-accent hover:underline">
<x-heroicon-o-arrow-uturn-left class="size-5" aria-hidden="true" />Zum Foto
</button>
</div>
</div>
</div>
</li>
@endforeach
</ul>
</section>
@endif
+104
View File
@@ -0,0 +1,104 @@
<?php
namespace Tests\Feature;
use App\Models\Appearance;
use App\Models\Photo;
use App\Models\Site;
use Carbon\CarbonImmutable;
use Database\Seeders\PropertySeeder;
use Database\Seeders\SiteSeeder;
use Database\Seeders\WebsiteContentSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use Tests\TestCase;
class DesignElementsTest extends TestCase
{
use RefreshDatabase;
protected function setUp(): void
{
parent::setUp();
Storage::fake('public');
$this->travelTo(CarbonImmutable::parse('2026-10-22 10:00'));
$this->seed([PropertySeeder::class, WebsiteContentSeeder::class, SiteSeeder::class]);
$this->withoutVite();
}
public function test_tip_cards_show_photo_and_name_in_front_and_the_tip_on_the_back(): void
{
$photo = $this->photoWithImage('Buchen im Gespensterwald');
$this->addSection(['type' => 'tips', 'data' => [
'heading' => 'Unsere Tipps',
'signature' => 'Brigitte',
'tips' => [
['title' => 'Gespensterwald', 'photo_id' => $photo->id, 'tip' => 'Am späten Nachmittag, wenn die Sonne durch die Buchen fällt.', 'way' => '25 Minuten mit dem Rad', 'best_time' => 'Später Nachmittag'],
['title' => 'Molli', 'photo_id' => null, 'tip' => 'Einmal bis Bad Doberan und zurück.', 'way' => null, 'best_time' => null],
['title' => 'Ohne Tipp', 'tip' => ''],
],
]]);
$this->get('/')
->assertOk()
->assertSee('data-flip-face="back"', false)
->assertSeeInOrder(['Gespensterwald', 'Buchen im Gespensterwald', 'Tipp lesen', 'Am späten Nachmittag', 'Brigitte', '25 Minuten mit dem Rad', 'Später Nachmittag', 'Molli', 'Einmal bis Bad Doberan'])
->assertDontSee('Ohne Tipp');
}
public function test_season_comparison_shows_both_photos_whatever_the_appearance_and_needs_both(): void
{
$summer = $this->photoWithImage('Terrasse im Sommer');
$winter = $this->photoWithImage('Terrasse im Schnee');
$winter->update(['appearance_ids' => [Appearance::factory()->create(['site_id' => Site::sole()->id, 'name' => 'Winter', 'is_active' => false])->id]]);
$this->addSection(['type' => 'compare', 'data' => [
'heading' => 'Derselbe Blick',
'first_photo_id' => $summer->id, 'first_label' => 'Sommer',
'second_photo_id' => $winter->id, 'second_label' => 'Winter',
]]);
$this->get('/')
->assertOk()
->assertSee('data-compare-range', false)
->assertSee('alt="Terrasse im Sommer"', false)
->assertSee('alt="Terrasse im Schnee"', false)
->assertSee('Trennlinie zwischen Sommer und Winter verschieben');
$winter->update(['is_published' => false]);
$this->get('/')->assertOk()->assertDontSee('data-compare-range', false)->assertDontSee('Derselbe Blick');
}
public function test_gallery_photos_open_in_the_lightbox_with_caption_and_browsing(): void
{
$photo = $this->photoWithImage('Wohnzimmer mit Ledersofa');
$photo->update(['caption' => 'Abends am Kamin']);
$page = Site::sole()->pages()->where('slug', 'wohnung')->sole();
$page->update(['sections' => [['type' => 'gallery', 'data' => ['heading' => 'Bilder', 'photo_source' => 'selection', 'photo_ids' => [$photo->id]]]]]);
$this->get('/wohnung')
->assertOk()
->assertSee('data-lightbox data-alt="Wohnzimmer mit Ledersofa" data-caption="Abends am Kamin"', false)
->assertSee('id="lightbox"', false)
->assertSee('aria-label="Nächstes Foto"', false);
}
private function photoWithImage(string $alt): Photo
{
$photo = Photo::factory()->create(['alt_text' => $alt]);
$photo->addMedia(UploadedFile::fake()->image('foto.jpg', 1200, 800))->toMediaCollection(Photo::COLLECTION);
return $photo->fresh();
}
/**
* @param array{type: string, data: array<string, mixed>} $section
*/
private function addSection(array $section): void
{
$page = Site::sole()->pages()->where('slug', 'start')->sole();
$page->update(['sections' => [...$page->sections, $section]]);
}
}