no picture tag if no file + remove previous seasons

This commit is contained in:
isUnknown 2024-09-04 14:23:32 +02:00
parent 99395b994f
commit 3377430e23
8 changed files with 45 additions and 69 deletions

View file

@ -35,5 +35,5 @@ body,
text-align: right;
}
.k-field-name-herotext .k-block-type-heading-input[data-level="h2"] .k-text {
text-align: center;
text-align: left;
}

View file

@ -15,6 +15,10 @@
margin-bottom: var(--padding-vertical);
}
.hero__text h2.big {
font-size: var(--font-size-xxl);
}
.hero__text h3 {
color: var(--color-salmon);
font-size: var(--font-size-h2);

View file

@ -10,6 +10,7 @@
--font-size-h2: 1.875rem;
--font-size-h1: 2.8125rem;
--font-size-xl: 3.75rem;
--font-size-xxl: 4.5rem;
--shift-large: 7vw;
--shift-medium: calc(var(--shift-large) / 2);

View file

@ -3,16 +3,6 @@ icon: title
wysiwyg: true
preview: heading
fields:
leftMargin:
label: ⇥ Marge gauche
type: radio
columns: 4
default: false
options:
false: Aucune
small: Petite
medium: Moyenne
large: Grande
level:
label: field.blocks.heading.level
type: toggles
@ -31,3 +21,10 @@ fields:
type: writer
inline: true
placeholder: field.blocks.heading.placeholder
isBig:
label: XL
type: toggle
help: Augmente la taille du texte
width: 1/3
when:
level: h2

View file

@ -3,16 +3,6 @@ icon: text
wysiwyg: true
preview: text
fields:
leftMargin:
label: ⇥ Marge gauche
type: radio
columns: 4
default: false
options:
false: Aucune
small: Petite
medium: Moyenne
large: Grande
text:
type: writer
nodes: false

View file

@ -1,2 +1,4 @@
<?php /** @var \Kirby\Cms\Block $block */ ?>
<<?= $level = $block->level()->or('h2') ?>><?= $block->text() ?></<?= $level ?>>
<<?php
echo $level = $block->level()->or('h2');
echo e($block->level()->value() === 'h2' && $block->isBig() == 'true', ' class="big"')
?>><?= $block->text() ?></<?= $level ?>>

View file

@ -1,31 +1,31 @@
<?php
<?php if (isset($file)): ?>
<?php
$sizes = '(min-width: 1200px) 25vw, (min-width: 900px) 33vw, (min-width: 600px) 50vw, 100vw';
$alt = $file->alt();
$crop = $crop ?? false;
$sizes = '(min-width: 1200px) 25vw, (min-width: 900px) 33vw, (min-width: 600px) 50vw, 100vw';
$alt = $file->alt();
$crop = $crop ?? false;
$webPSrcset = $crop === 'banner' ? $file->crop(1600, 800)->srcset('webp') : $file->srcset('webp');
$srcset = $crop === 'banner' ? $file->crop(1600, 800)->srcset() : $file->srcset();
$src = $crop === 'banner' ? $file->crop(1600, 800)->url() : $file->url();
$width = $crop === 'banner' ? $file->crop(1600, 800)->width() : $file->resize(1800)->width();
$height = $crop === 'banner' ? $file->crop(1600, 800)->height() : $file->resize(1800)->height();
?>
$webPSrcset = $crop === 'banner' ? $file->crop(1600, 800)->srcset('webp') : $file->srcset('webp');
$srcset = $crop === 'banner' ? $file->crop(1600, 800)->srcset() : $file->srcset();
$src = $crop === 'banner' ? $file->crop(1600, 800)->url() : $file->url();
$width = $crop === 'banner' ? $file->crop(1600, 800)->width() : $file->resize(1800)->width();
$height = $crop === 'banner' ? $file->crop(1600, 800)->height() : $file->resize(1800)->height();
?>
<picture>
<source srcset="<?= $webPSrcset ?>"
sizes="<?= $sizes ?>" type="image/webp">
<img
src="<?= $src ?>"
srcset="<?= $srcset ?>"
sizes="<?= $sizes ?>"
width="<?= $width ?>"
height="<?= $height ?>"
alt="<?= $alt?>"
loading="lazy"
>
<?= svg('assets/images/loader.svg') ?>
</picture>
<picture>
<source srcset="<?= $webPSrcset ?>"
sizes="<?= $sizes ?>" type="image/webp">
<img
src="<?= $src ?>"
srcset="<?= $srcset ?>"
sizes="<?= $sizes ?>"
width="<?= $width ?>"
height="<?= $height ?>"
alt="<?= $alt?>"
loading="lazy"
>
<?= svg('assets/images/loader.svg') ?>
</picture>
<?php endif ?>

View file

@ -146,25 +146,7 @@
<?php endforeach ?>
</section>
</div>
</template>
<!-- Saisons précédentes -->
<template x-if="tab.includes('Saisons précédentes')">
<div class="program-content__events">
<section class="collapsable-sections">
<?php foreach($previousSeasons as $previousSeason): ?>
<?php snippet('collapsable-section', ['title' => $previousSeason->title(), 'padding' => false], slots: true) ?>
<?php slot('content') ?>
<div class="program-content__events">
<?php snippet('events-grid', ['events' => $previousSeason->children(), 'columns' => 3]) ?>
</div>
<?php endslot() ?>
<?php endsnippet() ?>
<?php endforeach ?>
</section>
</div>
</template>
</template>
</div>
</div>
<?php snippet('footer') ?>