{% sw_extends '@Storefront/storefront/component/pagination.html.twig' %}
{% block component_pagination %}
{% set defaultClasses = 'block text-sm w-6 h-6 flex items-center outline outline-2 outline-transparent transition justify-center rounded cursor-pointer hover:bg-grey-900 hover:text-white lg:w-10 lg:h-10 lg:text-base' %}
{% set activeClasses = 'bg-grey-900 text-white' %}
<ul class="pagination flex items-center justify-center grid-gap-2 pt-4 pb-4">
{% block component_pagination_first %}
{% endblock %}
{% block component_pagination_prev %}
<li class="page-item page-prev mr-auto{% if currentPage == 1 %} disabled{% endif %}">
{% block component_pagination_prev_input %}
<input type="radio"
{% if currentPage == 1 %}disabled="disabled"{% endif %}
name="p"
id="p-prev{{ paginationSuffix }}"
value="{{ currentPage - 1 }}"
class="hidden peer"
title="pagination">
{% endblock %}
{% block component_pagination_prev_label %}
<label class="page-link btn btn-primary !p-2{% if currentPage == 1 %} disabled{% endif %}"
for="p-prev{{ paginationSuffix }}">
{% block component_pagination_prev_link %}
{% block component_pagination_prev_icon %}
{% sw_icon 'arrow-left' style { 'pack': 'hero', 'class': ' w-5 h-5'} %}
<span class="hidden capitalize text-sm lg:block">
{{ "general.previous"|trans }}
</span>
{% endblock %}
{% endblock %}
</label>
{% endblock %}
</li>
{% endblock %}
{% block component_pagination_loop %}
{% set start = currentPage - 2 %}
{% if start <= 0 %}
{% set start = currentPage - 1 %}
{% if start <= 0 %}
{% set start = currentPage %}
{% endif %}
{% endif %}
{% set end = start + 4 %}
{% if end > totalPages %}
{% set end = totalPages %}
{% endif %}
{% for page in start..end %}
{% set isActive = (currentPage == page) %}
{% block component_pagination_item %}
<li class="page-item">
{% block component_pagination_item_input %}
<input type="radio"
name="p"
id="p{{ page }}{{ paginationSuffix }}"
value="{{ page }}"
class="hidden peer"
title="pagination"
{% if isActive %}checked="checked"{% endif %}>
{% endblock %}
{% block component_pagination_item_label %}
<label class="page-link {{ defaultClasses }} {% if isActive %} active {{ activeClasses }}{% endif %}"
for="p{{ page }}{{ paginationSuffix }}">
{% block component_pagination_item_link %}
{% block component_pagination_item_text %}
{{ page }}
{% endblock %}
{% endblock %}
</label>
{% endblock %}
</li>
{% endblock %}
{% endfor %}
{% endblock %}
{% block component_pagination_next %}
<li class="page-item page-next ml-auto{% if currentPage == totalPages %} disabled{% endif %}">
{% block component_pagination_next_input %}
<input type="radio"
{% if currentPage == totalPages %}disabled="disabled"{% endif %}
name="p"
id="p-next{{ paginationSuffix }}"
value="{{ currentPage + 1 }}"
class="hidden peer"
title="pagination">
{% endblock %}
{% block component_pagination_next_label %}
<label class="page-link btn btn-primary !p-2{% if currentPage == totalPages %} disabled{% endif %}"
for="p-next{{ paginationSuffix }}">
{% block component_pagination_next_link %}
{% block component_pagination_next_icon %}
<span class="hidden capitalize text-sm lg:block">
{{ "general.next"|trans }}
</span>
{% sw_icon 'arrow-right' style { 'pack': 'hero', 'class': ' w-5 h-5'} %}
{% endblock %}
{% endblock %}
</label>
{% endblock %}
</li>
{% endblock %}
{% block component_pagination_last %}
{% endblock %}
</ul>
{% endblock %}