actuel-inactuel/site/snippets/nav.php

122 lines
3.1 KiB
PHP
Raw Normal View History

<div id="entry-btns">
<button
class="entry-btn entry-btn--left"
onclick="togglePanel('left')"
>années</button>
<button
class="entry-btn entry-btn--right"
onclick="togglePanel('right')"
>categories</button>
</div>
2024-04-09 17:10:43 +02:00
<nav
class="panel panel--left"
x-data="{search: ''}"
>
<span class="search">
<input
class="search__input"
type="text"
placeholder="page, auteur, année etc."
x-model="search"
>
<img
src="<?= url('assets/images/icons/search.svg') ?>"
class="search__icon"
alt="Icône loupe indiquant le champ de recherche."
>
</span>
<ul id="result"></ul>
<ul id="panel__items">
<?php foreach($kirby->collection('years') as $year): ?>
2024-04-09 08:38:29 +02:00
<li
2024-04-09 10:44:12 +02:00
class="panel__item "
2024-04-09 08:38:29 +02:00
x-data='{ year: false }'
>
<button
2024-04-09 10:44:12 +02:00
class="panel__toggle-btn"
2024-04-09 08:38:29 +02:00
:class="year ? '' : 'short'"
@click="year = !year"
>
2024-04-09 17:10:43 +02:00
<h3 class="fs-xl color" style="--color:var(--color-secondary)"><?= $year->title() ?><span x-show="search.length > 0" x-text="` > 1`"></span></h3>
<div
2024-04-09 10:44:12 +02:00
class="panel__toggle-icon"
2024-04-09 08:38:29 +02:00
x-text="year ? '-' : '+'"
></div>
</button>
<div
2024-04-09 10:44:12 +02:00
class="panel-item-content"
2024-04-09 08:38:29 +02:00
x-show="year"
x-data="{edito: false}"
>
<div
2024-04-09 10:44:12 +02:00
class="panel-item-content__edito"
2024-04-09 08:38:29 +02:00
:class="edito ? '' : 'short'"
>
2024-04-09 08:38:29 +02:00
<?= $year->edito() ?>
</div>
2024-04-09 08:38:29 +02:00
<button
:class="edito ? 'open' : 'close'"
class="see-more toggle left" @click="edito = !edito"
>Lire</button>
2024-04-09 10:44:12 +02:00
<ul class="panel-item-content__texts">
2024-04-09 08:38:29 +02:00
<?php foreach($year->children() as $article): ?>
<?php snippet(
'text-item',
array('article' => $article)
) ?>
<?php endforeach ?>
</ul>
</div>
</li>
<?php endforeach ?>
</ul>
2024-04-09 08:38:29 +02:00
<button
onclick="togglePanel('left')"
2024-04-09 10:44:12 +02:00
class="panel-close"
>fermer</button>
</nav>
2024-04-09 10:44:12 +02:00
<nav class="panel panel--right">
<ul>
<?php foreach($kirby->collection('categories') as $category): ?>
<li
class="panel__item"
x-data='{ category: false }'
2024-04-09 12:35:24 +02:00
x-show="<?= count($category['texts']) ?> > 0"
2024-04-09 10:44:12 +02:00
>
<button
class="panel__toggle-btn"
:class="category ? '' : 'short'"
@click="category = !category"
>
<h3 class="fs-xl color" style="--color:var(--color-secondary)"><?= $category['title'] ?></h3>
<div
class="panel__toggle-icon"
x-text="category ? '-' : '+'"
></div>
</button>
<div
class="panel-item-content"
x-show="category"
>
<ul class="panel-item-content__texts">
<?php foreach($category['texts'] as $article): ?>
<?php snippet(
'text-item',
array('article' => $article)
) ?>
<?php endforeach ?>
</ul>
</div>
</li>
<?php endforeach ?>
</ul>
<button
onclick="togglePanel('right')"
class="panel-close"
>fermer</button>
</nav>