actuel-inactuel/site/templates/category.php
2024-04-09 17:10:43 +02:00

58 lines
No EOL
1.7 KiB
PHP

<?php snippet('header'); ?>
<main id="<?= $page->template() ?>">
<article>
<?php snippet('cover', slots: true) ?>
<?php slot('title') ?>
<h1 class="main-title <?= setTitleFontSizeClass($page->title()) ?>"><?= $page->title() ?></h1>
<p class="light">catégorie</p>
<?php endslot() ?>
<?php endsnippet() ?>
<div
class="active-tab"
>
<ul>
<?php foreach($kirby->collection('years') as $year): ?>
<?php if (A::some($year->children()->toArray(), function ($text) use ($page) {
return $text['content']['category'] == $page->title()->value();
})): ?>
<li>
<div
x-data='{
isOpen: false
}'
:class="isOpen ? '' : 'short'"
class="
texts__year
| full-width
flex column
bottom"
style="
--content: center;
--bottom: 2;"
>
<h3 class="fs-xl color" style="--color:var(--color-secondary)"><?= $year->title() ?></h3>
<div class="year__edito">
<?= $year->edito() ?>
</div>
<button
:class="isOpen ? 'open' : 'close'"
class="see-more toggle left" @click="isOpen = !isOpen"
>
Lire
</button>
</div>
<ul>
<?php foreach($year->children() as $article): ?>
<?php if ($article->category() == $page->title()->value()) : ?>
<?php snippet('text-item', array('article' => $article)) ?>
<?php endif ?>
<?php endforeach ?>
</ul>
</li>
<?php endif ?>
<?php endforeach ?>
</ul>
</div>
</article>
</main>