-
Notifications
You must be signed in to change notification settings - Fork 934
/
usa-pagination.twig
34 lines (30 loc) · 1.19 KB
/
usa-pagination.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{% from "@components/usa-pagination/src/includes/_pagination-button.twig" import paginationButton %}
{% from "@components/usa-pagination/src/includes/_pagination-arrow.twig" import paginationArrow %}
{% set overflow %}
<li class="usa-pagination__item usa-pagination__overflow" aria-label="ellipsis indicating non-visible pages">
<span>
…
</span>
</li>
{% endset %}
<nav aria-label="{{ aria_label }}" class="usa-pagination">
<ul class="usa-pagination__list">
{% block pagination_content %}
{# Previous page #}
{# Don't show `Previous` button if on first page #}
{% if pagination.current > 1 %}
{{ paginationArrow('previous', pagination) }}
{% endif %}
{% if not pagination.unbounded %}
{% include "@components/usa-pagination/src/includes/_pagination-numbers--default.twig" %}
{% else %}
{% include "@components/usa-pagination/src/includes/_pagination-numbers--unbounded.twig" %}
{% endif %}
{# Next page #}
{# Don't show `next` button if on last page #}
{% if pagination.current != pagination.items %}
{{ paginationArrow('next', pagination) }}
{% endif %}
{% endblock %}
</ul>
</nav>