congo/layouts/partials/pagination.html

40 lines
1.0 KiB
HTML

{{ $paginator := .Paginator }}
{{ if gt $paginator.TotalPages 1 }}
<ul class="flex flex-row mt-8">
{{ if $paginator.HasPrev }}
<li>
<a
href="{{ $paginator.Prev.URL }}"
class="mx-1 block min-w-[1.8rem] text-center hover:bg-primary-600 hover:text-white rounded"
rel="prev"
>
&larr;
</a>
</li>
{{ end }}
{{ range $paginator.Pagers }}
<li>
<a
href="{{ .URL }}"
class="mx-1 block min-w-[1.8rem] text-center hover:bg-primary-600 hover:text-white rounded {{ if eq . $paginator }}
bg-primary-200 dark:bg-primary-400 dark:text-gray-800
{{ end }}"
>
{{ .PageNumber }}
</a>
</li>
{{ end }}
{{ if $paginator.HasNext }}
<li>
<a
href="{{ $paginator.Next.URL }}"
class="mx-1 block min-w-[1.8rem] text-center hover:bg-primary-600 hover:text-white rounded"
rel="next"
>
&rarr;
</a>
</li>
{{ end }}
</ul>
{{ end }}