{{- /* Custom pagination component.
       Call as: {{ partial "pagination.html" . }}
*/ -}}
{{- $paginator := .Paginator -}}
{{- if gt $paginator.TotalPages 1 -}}
<nav class="flex items-center justify-center gap-2 py-16" aria-label="Pagination">

  {{- if $paginator.HasPrev -}}
  <a
    href="{{ $paginator.Prev.URL }}"
    class="label border border-mist text-ash px-5 py-3 hover:border-gold hover:text-gold transition-all duration-300"
    aria-label="Previous page"
  >{{ partial "icon.html" "arrow-left" }} Prev</a>
  {{- end -}}

  {{- range $paginator.Pagers -}}
  <a
    href="{{ .URL }}"
    class="label border px-4 py-3 transition-all duration-300 {{ if eq . $paginator }}border-gold text-gold{{ else }}border-mist text-ash hover:border-gold hover:text-gold{{ end }}"
    {{- if eq . $paginator }} aria-current="page"{{ end }}
  >{{ .PageNumber }}</a>
  {{- end -}}

  {{- if $paginator.HasNext -}}
  <a
    href="{{ $paginator.Next.URL }}"
    class="label border border-mist text-ash px-5 py-3 hover:border-gold hover:text-gold transition-all duration-300"
    aria-label="Next page"
  >Next {{ partial "icon.html" "arrow-right" }}</a>
  {{- end -}}

</nav>
{{- end -}}
