meilisearch-admin/app/components/pagination.hbs
Stanislav Romanov 920e4b0d2c Refactore icons
2022-04-26 13:28:40 +03:00

50 lines
1.5 KiB
Handlebars

{{#if (gt this.totalPages 1)}}
<nav class="flex justify-center relative z-0 my-4" aria-label="Pagination">
{{#let
'inline-flex items-center justify-center px-2 mx-1 font-display text-lg' as |commonClasses|
}}
{{#if this.previousPage}}
<LinkTo
@route={{this.router.currentRouteName}}
@models={{if @model (array @model) (array)}}
@query={{hash page=this.previousPage}}
class={{commonClasses}}
title="Previous page"
>
<MdIcon::ChevronLeft />
</LinkTo>
{{/if}}
{{#each this.availablePages as |i|}}
{{#if (eq @current i)}}
<span class="{{commonClasses}} border rounded">
{{i}}
</span>
{{else if (eq '...' i)}}
<span class={{commonClasses}}>
{{i}}
</span>
{{else}}
<LinkTo
@route={{this.router.currentRouteName}}
@models={{if @model (array @model) (array)}}
@query={{hash page=i}}
class={{commonClasses}}
>
{{i}}
</LinkTo>
{{/if}}
{{/each}}
{{#if this.nextPage}}
<LinkTo
@route={{this.router.currentRouteName}}
@models={{if @model (array @model) (array)}}
@query={{hash page=this.nextPage}}
class={{commonClasses}}
title="Next page"
>
<MdIcon::ChevronRight />
</LinkTo>
{{/if}}
{{/let}}
</nav>
{{/if}}