55 lines
1.5 KiB
Handlebars
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}}
|