- Parser additions, pagination

This commit is contained in:
Ty Clifford
2026-07-04 20:29:34 -04:00
parent c4c10c256c
commit bb93bf58fe
6 changed files with 167 additions and 11 deletions
+12 -1
View File
@@ -30,11 +30,22 @@ $renderPagination = static function (array $pagination, callable $url): void { ?
<nav class="pagination" aria-label="Pagination">
<?php if ($pagination['has_previous']): ?>
<a class="pager" href="<?= $url((int) $pagination['previous']) ?>">Previous</a>
<?php else: ?>
<span class="pager pager--disabled" aria-disabled="true">Previous</span>
<?php endif; ?>
<span>Page <?= (int) $pagination['page'] ?> of <?= (int) $pagination['pages'] ?></span>
<?php foreach (($pagination['numbers'] ?? []) as $number): ?>
<?php if ((int) $number === (int) $pagination['page']): ?>
<span class="pager pager--current" aria-current="page"><?= (int) $number ?></span>
<?php else: ?>
<a class="pager pager--number" href="<?= $url((int) $number) ?>"><?= (int) $number ?></a>
<?php endif; ?>
<?php endforeach; ?>
<?php if ($pagination['has_next']): ?>
<a class="pager" href="<?= $url((int) $pagination['next']) ?>">Next</a>
<?php else: ?>
<span class="pager pager--disabled" aria-disabled="true">Next</span>
<?php endif; ?>
<span class="pagination__summary">Page <?= (int) $pagination['page'] ?> of <?= (int) $pagination['pages'] ?> · <?= (int) $pagination['per_page'] ?> per page</span>
</nav>
<?php endif; ?>
<?php };