Biete Bildausschnitt und Zoom für Bilder und Videos in Widgets an (ADR-70)
Redaktionelle Karten erhalten je Karte Fokus und Zoom, Einstieg, Bild und Text sowie Premium-Karten zusätzlich einen Zoom (100 bis 250 Prozent, darunter entstünden leere Ränder). Die Darstellung ist reines CSS um den Fokuspunkt; Video und Clip folgen dem Ausschnitt. Die Regler zeigen beim Laden die Vorgabe statt 0 (FramingSlider). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7f9534d289
commit
9353e2e38a
29 files changed
+641
-40
No files matched your search
@@ -30,7 +30,7 @@
|
||||
])>
|
||||
@if ($item['imageUrl'])
|
||||
<div class="card-media">
|
||||
<img class="card-image" src="{{ $item['imageUrl'] }}" @if (! empty($item['imageSrcset'])) srcset="{{ $item['imageSrcset'] }}" sizes="(min-width: 900px) 40vw, 100vw" @endif alt="" loading="lazy" decoding="async">
|
||||
<img class="card-image" src="{{ $item['imageUrl'] }}" @if (! empty($item['imageSrcset'])) srcset="{{ $item['imageSrcset'] }}" sizes="{{ $item['imageSizes'] }}" @endif{!! $item['imageStyle'] !== null ? ' style="'.e($item['imageStyle']).'"' : '' !!} alt="" loading="lazy" decoding="async">
|
||||
</div>
|
||||
@endif
|
||||
<div class="card-body">
|
||||
|
||||
@@ -15,16 +15,23 @@
|
||||
$loading = ! empty($first) ? 'loading="eager" fetchpriority="high"' : 'loading="lazy"';
|
||||
$videoUrl = $layout === 'photo-split' ? ($video['url'] ?? null) : null;
|
||||
$videoTitle = $video['title'] ?? '';
|
||||
// Zoom (ADR-70): Foto und Video liegen dann in einem Rahmen, der den vergrößerten Ausschnitt abschneidet.
|
||||
$zoomPercent = (int) ($zoom ?? 100);
|
||||
$zoomed = $zoomPercent > 100 && $layout === 'photo-split' && ($imageUrl || $videoUrl !== null);
|
||||
@endphp
|
||||
<div class="lf-hero-host">
|
||||
<div class="lf-hero lf-hero--{{ $layout }} lf-hero--height-{{ $heightClass }} lf-hero--accent-{{ $accent }}"
|
||||
style="--lf-hero-focus-x: {{ $focus['x'] }}%; --lf-hero-focus-y: {{ $focus['y'] }}%"
|
||||
style="--lf-hero-focus-x: {{ $focus['x'] }}%; --lf-hero-focus-y: {{ $focus['y'] }}%@if ($zoomed); --lf-hero-zoom: {{ $zoomPercent / 100 }}@endif"
|
||||
@if ($videoUrl !== null) data-hero-video data-clip-src="{{ $videoUrl }}" data-clip-title="{{ $videoTitle }}" @endif>
|
||||
@if ($zoomed)<div class="lf-hero__frame">@endif
|
||||
@if ($layout === 'photo-split' && $imageUrl)
|
||||
<img class="lf-hero__photo" src="{{ $imageUrl }}" @if (! empty($imageSrcset)) srcset="{{ $imageSrcset }}" sizes="100vw"@endif alt="{{ $imageAlt ?? '' }}" {!! $loading !!} decoding="async">
|
||||
<img class="lf-hero__photo" src="{{ $imageUrl }}" @if (! empty($imageSrcset)) srcset="{{ $imageSrcset }}" sizes="{{ \App\Domain\Cms\Widgets\Support\ImageFraming::sizes('100vw', $zoomPercent) }}"@endif alt="{{ $imageAlt ?? '' }}" {!! $loading !!} decoding="async">
|
||||
@endif
|
||||
@if ($videoUrl !== null)
|
||||
<video class="lf-hero__video" muted loop playsinline preload="none" disablepictureinpicture disableremoteplayback tabindex="-1" aria-hidden="true"></video>
|
||||
@endif
|
||||
@if ($zoomed)</div>@endif
|
||||
@if ($videoUrl !== null)
|
||||
<button type="button" class="lf-hero__video-toggle" aria-pressed="false" data-hero-toggle aria-label="Video abspielen: {{ $videoTitle }}" hidden>
|
||||
<svg class="lf-hero__video-icon" viewBox="0 0 24 24" focusable="false" aria-hidden="true"><path class="lf-hero__video-play" d="M8 5.5v13l11-6.5z" fill="currentColor"/><path class="lf-hero__video-pause" d="M7 5h4v14H7zM13 5h4v14h-4z" fill="currentColor"/></svg>
|
||||
<span class="lf-hero__video-label" aria-hidden="true">Video</span>
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
$tag = \App\Domain\Cms\Widgets\Support\PremiumFields::headingTag($settings, ! empty($first));
|
||||
$hasCopy = $hasCopy ?? true;
|
||||
$imageShare = $imageShare ?? null;
|
||||
// Zoom (ADR-70): Bild und Video liegen dann in einem Rahmen, der den vergrößerten Ausschnitt abschneidet.
|
||||
$zoomPercent = (int) ($zoom ?? 100);
|
||||
$zoomed = $zoomPercent > 100;
|
||||
$clipUrl = $imageUrl ? ($video['url'] ?? null) : null;
|
||||
$clipTitle = (string) ($video['title'] ?? '');
|
||||
@endphp
|
||||
@@ -27,7 +30,7 @@
|
||||
'lf-bt--without-text' => ! $hasCopy,
|
||||
'lf-bt--shared' => $imageShare !== null && $imageUrl && $hasCopy,
|
||||
'lf-bt--share-'.$imageShare => $imageShare !== null && $imageUrl && $hasCopy,
|
||||
]) style="--bt-focus-x: {{ $focus['x'] }}%; --bt-focus-y: {{ $focus['y'] }}%">
|
||||
]) style="--bt-focus-x: {{ $focus['x'] }}%; --bt-focus-y: {{ $focus['y'] }}%@if ($zoomed); --bt-zoom: {{ $zoomPercent / 100 }}@endif">
|
||||
@if ($hasCopy)
|
||||
<div class="lf-bt__copy">
|
||||
@php($lead = \App\Domain\Cms\Widgets\Support\HeadingAccent::lead($settings))
|
||||
@@ -56,8 +59,10 @@
|
||||
@endif
|
||||
@if ($imageUrl)
|
||||
<div class="lf-bt__media" @if ($clipUrl !== null) data-card-clip data-clip-src="{{ $clipUrl }}" data-clip-title="{{ $clipTitle }}" @endif>
|
||||
<img class="lf-bt__image" src="{{ $imageUrl }}" @if (! empty($imageSrcset)) srcset="{{ $imageSrcset }}" sizes="100vw" @endif alt="{{ $imageAlt ?? '' }}" @if (! empty($first)) loading="eager" fetchpriority="high" @else loading="lazy" @endif decoding="async">
|
||||
@if ($zoomed)<div class="lf-bt__frame">@endif
|
||||
<img class="lf-bt__image" src="{{ $imageUrl }}" @if (! empty($imageSrcset)) srcset="{{ $imageSrcset }}" sizes="{{ \App\Domain\Cms\Widgets\Support\ImageFraming::sizes('100vw', $zoomPercent) }}" @endif alt="{{ $imageAlt ?? '' }}" @if (! empty($first)) loading="eager" fetchpriority="high" @else loading="lazy" @endif decoding="async">
|
||||
@include('widgets.partials.card-clip', ['clipFullscreen' => $clipUrl !== null && ! empty($videoFullscreen)])
|
||||
@if ($zoomed)</div>@endif
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
@elseif ($subject->public || $context->preview)
|
||||
@php
|
||||
$libraryImage = $imageUrl === null && $context->preview ? $subject->previewImage : null;
|
||||
// Zoom (ADR-70) wirkt nur auf den Ausschnitt; „Ganzes Bild“ zeigt das Bild vollständig und wird nicht vergrößert.
|
||||
$zoomPercent = ($fit ?? 'cover') === 'contain' ? 100 : (int) ($zoom ?? 100);
|
||||
$zoomed = $zoomPercent > 100;
|
||||
$panel = $imageUrl === null && $libraryImage === null ? $subject->visual : null;
|
||||
$action = $show['action'] && $subject->url !== null ? ['url' => $subject->url, 'label' => $actionLabel] : null;
|
||||
$meta = $show['meta'] ? $subject->meta : [];
|
||||
@@ -49,10 +52,11 @@
|
||||
'lf-pc--bare' => ! empty($bare),
|
||||
'lf-pc--without-visual' => $imageUrl === null && $libraryImage === null && $panel === null,
|
||||
'lf-pc--internal' => ! $subject->public,
|
||||
]) style="--pc-focus-x: {{ $focus['x'] }}%; --pc-focus-y: {{ $focus['y'] }}%">
|
||||
'lf-pc--zoom' => $zoomed,
|
||||
]) style="--pc-focus-x: {{ $focus['x'] }}%; --pc-focus-y: {{ $focus['y'] }}%@if ($zoomed); --pc-zoom: {{ $zoomPercent / 100 }}@endif">
|
||||
@if ($imageUrl !== null || $libraryImage !== null)
|
||||
<div class="lf-pc__visual" @if ($clipUrl !== null) data-card-clip data-clip-src="{{ $clipUrl }}" data-clip-title="{{ $clipTitle }}" @endif>
|
||||
<img class="lf-pc__image" src="{{ $imageUrl ?? $libraryImage }}" @if ($imageUrl !== null && ! empty($imageSrcset)) srcset="{{ $imageSrcset }}" sizes="(min-width: 900px) 50vw, 100vw" @endif alt="{{ $imageUrl !== null ? $alt : '' }}" loading="lazy" decoding="async">
|
||||
<img class="lf-pc__image" src="{{ $imageUrl ?? $libraryImage }}" @if ($imageUrl !== null && ! empty($imageSrcset)) srcset="{{ $imageSrcset }}" sizes="{{ \App\Domain\Cms\Widgets\Support\ImageFraming::sizes('(min-width: 900px) 50vw, 100vw', $zoomPercent) }}" @endif alt="{{ $imageUrl !== null ? $alt : '' }}" loading="lazy" decoding="async">
|
||||
@include('widgets.partials.card-clip')
|
||||
@if ($show['kind'] && $subject->badge !== null && empty($bare))
|
||||
<span class="lf-pc__badge">{{ $subject->badge }}</span>
|
||||
|
||||
Reference in new issue
Block a user