meilisearch-admin/app/components/pagination.hbs
Stanislav Romanov 3ed828ed7a Replace icons
2022-08-27 18:56:39 +03:00

55 lines
1.5 KiB
Handlebars

{{#if (gt this.totalPages 1)}}
<nav
class='flex justify-center relative z-0'
aria-label='Pagination'
...attributes
>
{{#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'
>
<Icons::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'
>
<Icons::ChevronRight />
</LinkTo>
{{/if}}
{{/let}}
</nav>
{{/if}}