Files
fewo-stommer/app/Themes/Sections/CompareSection.php
T
LarsandClaude Opus 5.5 4c9e6992f4
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m45s
Design Stufe 2: Tipp-Karten zum Umdrehen, Sommer/Winter-Vergleich, Galerie mit weichem Vergroessern
- 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>
2026-10-30 21:05:16 +01:00

60 lines
2.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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',
];
}
}