feat(*): refactor dynamic vs. static structure and distinctions; make additional elements dynamic
This commit is contained in:
parent
7a0b808f24
commit
203012eef7
129 changed files with 983 additions and 960 deletions
41
config/dynamic/paginator.php
Normal file
41
config/dynamic/paginator.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
if (!function_exists('renderPaginator')) {
|
||||
function renderPaginator(array $pagination, int $totalPages): void
|
||||
{
|
||||
if (!$pagination || $totalPages <= 1) return;
|
||||
?>
|
||||
|
||||
<script type="module" src="/assets/scripts/components/select-pagination.js" defer></script>
|
||||
<nav aria-label="Pagination" class="pagination">
|
||||
<?php if (!empty($pagination['href']['previous'])): ?>
|
||||
<a href="<?= $pagination['href']['previous'] ?>" aria-label="Previous page">
|
||||
<?= getTablerIcon('arrow-left') ?>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<span><?= getTablerIcon('arrow-left') ?></span>
|
||||
<?php endif; ?>
|
||||
<select-pagination data-base-index="1">
|
||||
<select class="client-side" aria-label="Page selection">
|
||||
<?php foreach ($pagination['pages'] as $i): ?>
|
||||
<option value="<?= $i ?>" <?= ($pagination['pageNumber'] === $i) ? 'selected' : '' ?>>
|
||||
<?= $i ?> of <?= $totalPages ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<noscript>
|
||||
<p><span aria-current="page"><?= $pagination['pageNumber'] ?></span> of <?= $totalPages ?></p>
|
||||
</noscript>
|
||||
</select-pagination>
|
||||
<?php if (!empty($pagination['href']['next'])): ?>
|
||||
<a href="<?= $pagination['href']['next'] ?>" aria-label="Next page">
|
||||
<?= getTablerIcon('arrow-right') ?>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<span><?= getTablerIcon('arrow-right') ?></span>
|
||||
<?php endif; ?>
|
||||
</nav>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue