custom/static-plugins/NdTheme/src/Resources/views/storefront/component/pagination.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/component/pagination.html.twig' %}
  2. {% block component_pagination %}
  3.     {% 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' %}
  4.     {% set activeClasses = 'bg-grey-900 text-white' %}
  5.     <ul class="pagination flex items-center justify-center grid-gap-2 pt-4 pb-4">
  6.         {% block component_pagination_first %}
  7.         {% endblock %}
  8.         {% block component_pagination_prev %}
  9.             <li class="page-item page-prev mr-auto{% if currentPage == 1 %} disabled{% endif %}">
  10.                 {% block component_pagination_prev_input %}
  11.                     <input type="radio"
  12.                            {% if currentPage == 1 %}disabled="disabled"{% endif %}
  13.                            name="p"
  14.                            id="p-prev{{ paginationSuffix }}"
  15.                            value="{{ currentPage - 1 }}"
  16.                            class="hidden peer"
  17.                            title="pagination">
  18.                 {% endblock %}
  19.                 {% block component_pagination_prev_label %}
  20.                     <label class="page-link btn btn-primary !p-2{% if currentPage == 1 %} disabled{% endif %}"
  21.                            for="p-prev{{ paginationSuffix }}">
  22.                         {% block component_pagination_prev_link %}
  23.                             {% block component_pagination_prev_icon %}
  24.                                 {% sw_icon 'arrow-left' style { 'pack': 'hero', 'class': ' w-5 h-5'} %}
  25.                                 <span class="hidden capitalize text-sm lg:block">
  26.                                 {{ "general.previous"|trans }}
  27.                                     </span>
  28.                             {% endblock %}
  29.                         {% endblock %}
  30.                     </label>
  31.                 {% endblock %}
  32.             </li>
  33.         {% endblock %}
  34.         {% block component_pagination_loop %}
  35.             {% set start = currentPage - 2 %}
  36.             {% if start <= 0 %}
  37.                 {% set start = currentPage - 1 %}
  38.                 {% if start <= 0 %}
  39.                     {% set start = currentPage %}
  40.                 {% endif %}
  41.             {% endif %}
  42.             {% set end = start + 4 %}
  43.             {% if end > totalPages %}
  44.                 {% set end = totalPages %}
  45.             {% endif %}
  46.             {% for page in start..end %}
  47.                 {% set isActive = (currentPage == page) %}
  48.                 {% block component_pagination_item %}
  49.                     <li class="page-item">
  50.                         {% block component_pagination_item_input %}
  51.                             <input type="radio"
  52.                                    name="p"
  53.                                    id="p{{ page }}{{ paginationSuffix }}"
  54.                                    value="{{ page }}"
  55.                                    class="hidden peer"
  56.                                    title="pagination"
  57.                                    {% if isActive %}checked="checked"{% endif %}>
  58.                         {% endblock %}
  59.                         {% block component_pagination_item_label %}
  60.                             <label class="page-link {{ defaultClasses }} {% if isActive %} active {{ activeClasses }}{% endif %}"
  61.                                    for="p{{ page }}{{ paginationSuffix }}">
  62.                                 {% block component_pagination_item_link %}
  63.                                     {% block component_pagination_item_text %}
  64.                                         {{ page }}
  65.                                     {% endblock %}
  66.                                 {% endblock %}
  67.                             </label>
  68.                         {% endblock %}
  69.                     </li>
  70.                 {% endblock %}
  71.             {% endfor %}
  72.         {% endblock %}
  73.         {% block component_pagination_next %}
  74.             <li class="page-item page-next ml-auto{% if currentPage == totalPages %} disabled{% endif %}">
  75.                 {% block component_pagination_next_input %}
  76.                     <input type="radio"
  77.                            {% if currentPage == totalPages %}disabled="disabled"{% endif %}
  78.                            name="p"
  79.                            id="p-next{{ paginationSuffix }}"
  80.                            value="{{ currentPage + 1 }}"
  81.                            class="hidden peer"
  82.                            title="pagination">
  83.                 {% endblock %}
  84.                 {% block component_pagination_next_label %}
  85.                     <label class="page-link btn btn-primary !p-2{% if currentPage == totalPages %} disabled{% endif %}"
  86.                            for="p-next{{ paginationSuffix }}">
  87.                         {% block component_pagination_next_link %}
  88.                             {% block component_pagination_next_icon %}
  89.                                 <span class="hidden capitalize text-sm lg:block">
  90.                                     {{ "general.next"|trans }}
  91.                                 </span>
  92.                                 {% sw_icon 'arrow-right' style { 'pack': 'hero', 'class': ' w-5 h-5'} %}
  93.                             {% endblock %}
  94.                         {% endblock %}
  95.                     </label>
  96.                 {% endblock %}
  97.             </li>
  98.         {% endblock %}
  99.         {% block component_pagination_last %}
  100.         {% endblock %}
  101.     </ul>
  102. {% endblock %}