design virtual pages

This commit is contained in:
isUnknown 2024-04-10 16:52:41 +02:00
parent 8e65a1cc64
commit c70b4890f8
12 changed files with 131 additions and 84 deletions

View file

@ -4,55 +4,33 @@
<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>
<h2 class="main-title <?= setTitleFontSizeClass($page->title()) ?>"><?= $page->title() ?></h2>
<?php endslot() ?>
<?php slot('text') ?>
<ul class="texts">
<?php foreach($kirby->collection('categories') as $category): ?>
<?php if ($category['title'] == $page->title()->value()): ?>
<?php foreach($category['texts'] as $article): ?>
<li
class="text"
>
<a href="<?= $article->url() ?>" class="text__title no-line">
<h4><?= $article->title() ?></h4>
</a>
<div class="text__infos">
<p>
<span class="light">par</span>
<a class="author" href="/auteurs/<?= Str::slug($article->author()->toUser()->name()) ?>"><?= $article->author()->toUser()->name() ?></a><br>
<span class="light">publié le </span><?= $article->published()->toDate('d/m/Y') ?><br>
<span class="light">dans</span> <a href="<?= $article->parent()->url() ?>"><?= $article->parent()->title() ?></a> / <a href="/categories/<?= $article->category() ?>"><?= $article->category() ?></a>
</p>
</div>
</li>
<?php endforeach ?>
<?php endif ?>
</ul>
<?php endforeach ?>
<?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>