home > slideshow : working
All checks were successful
Deploy / Deploy to Production (push) Successful in 2s

This commit is contained in:
isUnknown 2026-05-26 14:00:45 +02:00
parent 13040a9df3
commit 47e30e8d61
8 changed files with 118 additions and 63 deletions

View file

@ -1,20 +1,40 @@
<?php snippet('header') ?>
<div id="home-slideshow">
<?php foreach ($site->files()->sortBy('sort') as $file): ?>
<?php if ($file->type() === 'video'): ?>
<?php
$files = array_values($site->files()->sortBy('sort')->data());
$count = count($files);
$i = 0;
while ($i < $count):
$file = $files[$i];
$nextFile = $files[$i + 1] ?? null;
$isPortrait = $file->type() === 'image' && $file->orientation() === 'portrait';
$nextIsPortrait = $nextFile && $nextFile->type() === 'image' && $nextFile->orientation() === 'portrait';
?>
<?php if ($isPortrait && $nextIsPortrait): ?>
<div class="slide portrait-pair">
<?php snippet('picture', ['file' => $file, 'srcsetName' => 'home-slideshow', 'sizes' => '50vw', 'lazy' => false]) ?>
<?php snippet('picture', ['file' => $nextFile, 'srcsetName' => 'home-slideshow', 'sizes' => '50vw', 'lazy' => false]) ?>
</div>
<?php $i += 2 ?>
<?php elseif ($file->type() === 'video'): ?>
<div class="slide">
<video autoplay muted loop playsinline data-id="<?= $file->uuid() ?>">
<source src="<?= $file->url() ?>" type="<?= $file->mime() ?>">
</video>
<?php else: ?>
<?php snippet('picture', [
'file' => $file,
'srcsetName' => 'home-slideshow',
'sizes' => '100vw',
'lazy' => false,
]) ?>
<?php endif ?>
<?php endforeach ?>
</div>
<?php $i++ ?>
<?php else: ?>
<div class="slide">
<?php snippet('picture', ['file' => $file, 'srcsetName' => 'home-slideshow', 'sizes' => '100vw', 'lazy' => false]) ?>
</div>
<?php $i++ ?>
<?php endif ?>
<?php endwhile ?>
<button class="prev"></button>
<button class="next"></button>
</div>