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
nodes: 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:
label: Preview
label: Preview vidéo
type: files
multiple: false
help: Extrait joué en autoplay muet.
width: 1/3
when:
heroType: video
help: "Extrait joué en autoplay muet. À remplir avec l'URL vidéo — les deux champs vont ensemble."
width: 1/2
videoUrl:
label: URL vidéo complète (YouTube embed)
type: url
width: 1/3
when:
heroType: video
width: 1/2
help: "À remplir avec la preview — les deux champs vont ensemble."
heroCaption:
label: Légende du hero
type: writer

View file

@ -29,27 +29,17 @@
<div class="page__content">
<?php if ($page->heroType()->value() == 'image'): ?>
<?php if ($heroImage = $page->heroImages()->toFile()): ?>
<!-- HERO IMAGE SIMPLE -->
<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
$videoPreview = $page->videoPreview()->toFile();
$hasVideo = $videoPreview || $page->videoUrl()->isNotEmpty();
?>
<?php elseif ($page->heroType()->value() == 'video'): ?>
<?php if ($hasVideo): ?>
<!-- HERO VIDEO -->
<div id="investigation__hero" class="hero-video">
<div class="player-container">
<?php if ($videoPreview = $page->videoPreview()->toFile()): ?>
<?php if ($videoPreview): ?>
<div class="extract">
<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>
@ -67,6 +57,20 @@
<?php endif ?>
</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 ?>