home > hero : enable custom event infos

This commit is contained in:
isUnknown 2024-10-31 15:35:46 +01:00
parent 4dc2164820
commit d250164915
2 changed files with 50 additions and 20 deletions

View file

@ -44,8 +44,14 @@ tabs:
columns: 2
default: nextEvent
options:
nextEvent: Prochain événement
event: Événement
custom: Personnalisé
heroEvent:
label: Événement
type: pages
query: page('programme').grandChildren
when:
heroMode: event
heroText:
label: Text
type: blocks

View file

@ -1,26 +1,50 @@
<?php snippet('header') ?>
<section class="hero">
<div class="hero__text">
<?= $site->heroText()->toBlocks() ?>
<?php if ($site->heroLinkUrl()->isNotEmpty() == 'true'): ?>
<a class="hero__link h3" href="<?= $site->heroLinkUrl()->toUrl() ?>"><?php e($site->heroLinkText()->isNotEmpty() == 'true', $site->heroLinkText(), $site->heroLinkUrl()->toUrl()) ?></a>
<?php endif ?>
</div>
<div class="hero__image" style="--color: var(--color-season)">
<?php if ($site->heroLinkUrl()->isNotEmpty() == 'true'): ?>
<a href="<?= $site->heroLinkUrl()->toUrl() ?>" title="en savoir plus"></a>
<?php endif ?>
<div class="image-wrapper">
<?php if ($site->heroImage()->toFiles()->count() > 1): ?>
<?php snippet('picture', [
'file' => $site->heroImage()->toFiles()->first(),
'class' => 'image-cover',
'size' => 60
]) ?>
<?php if ($site->heroMode() == 'custom'): ?>
<div class="hero__text">
<?= $site->heroText()->toBlocks() ?>
<?php if ($site->heroLinkUrl()->isNotEmpty() == 'true'): ?>
<a class="hero__link h3" href="<?= $site->heroLinkUrl()->toUrl() ?>"><?php e($site->heroLinkText()->isNotEmpty() == 'true', $site->heroLinkText(), $site->heroLinkUrl()->toUrl()) ?></a>
<?php endif ?>
<?php snippet('picture', ['file' => $site->heroImage()->toFiles()->count() > 1 ? $site->heroImage()->toFiles()->nth(1) : $site->heroImage()->toFiles()->first(), 'lazy' => false, 'size' => 60]) ?>
</div>
</div>
<div class="hero__image" style="--color: var(--color-season)">
<?php if ($site->heroLinkUrl()->isNotEmpty() == 'true'): ?>
<a href="<?= $site->heroLinkUrl()->toUrl() ?>" title="en savoir plus"></a>
<?php endif ?>
<div class="image-wrapper">
<?php if ($site->heroImage()->toFiles()->count() > 1): ?>
<?php snippet('picture', [
'file' => $site->heroImage()->toFiles()->first(),
'class' => 'image-cover',
'size' => 60
]) ?>
<?php endif ?>
<?php snippet('picture', ['file' => $site->heroImage()->toFiles()->count() > 1 ? $site->heroImage()->toFiles()->nth(1) : $site->heroImage()->toFiles()->first(), 'lazy' => false, 'size' => 60]) ?>
</div>
</div>
<?php else: ?>
<?php $heroEvent = $site->heroEvent()->toPage(); ?>
<div class="hero__text">
<h2>
<?= $heroEvent->title() ?>
</h2>
<?= $heroEvent->chapo() ?>
<a class="hero__link h3" href="<?= $heroEvent->url() ?>">Découvrir</a>
</div>
<div class="hero__image" style="--color: var(--color-season)">
<a href="<?= $heroEvent->url() ?>" title="en savoir plus"></a>
<div class="image-wrapper">
<?php if ($heroEvent->gallery()->toFiles()->count() > 1): ?>
<?php snippet('picture', [
'file' => $heroEvent->gallery()->toFiles()->first(),
'class' => 'image-cover',
'size' => 60
]) ?>
<?php endif ?>
<?php snippet('picture', ['file' => $heroEvent->gallery()->toFiles()->count() > 1 ? $heroEvent->gallery()->toFiles()->nth(1) : $heroEvent->gallery()->toFiles()->first(), 'lazy' => false, 'size' => 60]) ?>
</div>
</div>
<?php endif ?>
</section>
<?php snippet('calendar-strip') ?>