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>
60 lines
2.3 KiB
PHP
60 lines
2.3 KiB
PHP
<?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',
|
||
];
|
||
}
|
||
}
|