investigation → simplification du hero
All checks were successful
Deploy / Deploy to Production (push) Successful in 12s

This commit is contained in:
Julie Blanc 2026-02-19 15:25:44 +01:00
parent 65e8290edf
commit cc7c9f5dab
2 changed files with 25 additions and 41 deletions

View file

@ -32,37 +32,17 @@ tabs:
type: writer type: writer
nodes: false nodes: false
buttons: false buttons: false
heroType:
label: Type de hero
type: select
default: image
options:
image: Image simple
video: Vidéo
default: image
width: 1/3
heroImages:
label: Images hero
type: files
multiple: true
layout: cards
width: 1/3
when:
heroType: image
videoPreview: videoPreview:
label: Preview label: Preview vidéo
type: files type: files
multiple: false multiple: false
help: Extrait joué en autoplay muet. help: "Extrait joué en autoplay muet. À remplir avec l'URL vidéo — les deux champs vont ensemble."
width: 1/3 width: 1/2
when:
heroType: video
videoUrl: videoUrl:
label: URL vidéo complète (YouTube embed) label: URL vidéo complète (YouTube embed)
type: url type: url
width: 1/3 width: 1/2
when: help: "À remplir avec la preview — les deux champs vont ensemble."
heroType: video
heroCaption: heroCaption:
label: Légende du hero label: Légende du hero
type: writer type: writer

View file

@ -29,27 +29,17 @@
<div class="page__content"> <div class="page__content">
<?php if ($page->heroType()->value() == 'image'): ?> <?php
<?php if ($heroImage = $page->heroImages()->toFile()): ?> $videoPreview = $page->videoPreview()->toFile();
<!-- HERO IMAGE SIMPLE --> $hasVideo = $videoPreview || $page->videoUrl()->isNotEmpty();
<div id="investigation__hero"> ?>
<figure>
<img src="<?= $heroImage->url() ?>" alt="<?= $page->title()->esc() ?>">
</figure>
<?php if ($page->heroCaption()->isNotEmpty()): ?>
<figcaption><?= $page->heroCaption()->inline() ?></figcaption>
<?php elseif ($heroImage->caption()->isNotEmpty()): ?>
<figcaption><?= $heroImage->caption() ?></figcaption>
<?php endif ?>
</div>
<?php endif ?>
<?php elseif ($page->heroType()->value() == 'video'): ?> <?php if ($hasVideo): ?>
<!-- HERO VIDEO --> <!-- HERO VIDEO -->
<div id="investigation__hero" class="hero-video"> <div id="investigation__hero" class="hero-video">
<div class="player-container"> <div class="player-container">
<?php if ($videoPreview = $page->videoPreview()->toFile()): ?> <?php if ($videoPreview): ?>
<div class="extract"> <div class="extract">
<video class="vjs-tech" id="player-element_html5_api" tabindex="-1" loop="" muted="muted" playsinline="playsinline" autoplay="" src="<?= $videoPreview->url() ?>"></video> <video class="vjs-tech" id="player-element_html5_api" tabindex="-1" loop="" muted="muted" playsinline="playsinline" autoplay="" src="<?= $videoPreview->url() ?>"></video>
<button id="hero-play-video"><span class="btn--bold"><?= svg('assets/icons/play.svg') ?> <span class="text">play video</span></button> <button id="hero-play-video"><span class="btn--bold"><?= svg('assets/icons/play.svg') ?> <span class="text">play video</span></button>
@ -67,6 +57,20 @@
<?php endif ?> <?php endif ?>
</div> </div>
<?php elseif ($cover = $page->cover()->toFile()): ?>
<!-- HERO IMAGE (cover) -->
<div id="investigation__hero">
<figure>
<img src="<?= $cover->url() ?>" alt="<?= $page->title()->esc() ?>">
</figure>
<?php if ($page->heroCaption()->isNotEmpty()): ?>
<figcaption><?= $page->heroCaption()->inline() ?></figcaption>
<?php elseif ($cover->caption()->isNotEmpty()): ?>
<figcaption><?= $cover->caption() ?></figcaption>
<?php endif ?>
</div>
<?php endif ?> <?php endif ?>