This repository has been archived by the owner on Jan 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add "hideWhenEmpty" option to UiPager navbar
- Loading branch information
1 parent
53d69bc
commit 563de37
Showing
3 changed files
with
101 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,82 @@ | ||
<nav aria-label={{this.ariaLabel}}> | ||
<ul class="pagination"> | ||
<li class={{if this.disablePrevButtons "disabled"}}> | ||
<a | ||
href="#" | ||
role="button" | ||
class="page-item" | ||
title="Go to first page" | ||
aria-label="Go to first page" | ||
aria-disabled="{{this.disablePrevButtons}}" | ||
aria-current="false" | ||
onclick={{action this.handleNavigation "first"}} | ||
> | ||
<UiIcon @name="angle-double-left" /> | ||
</a> | ||
</li> | ||
|
||
<li class={{if this.disablePrevButtons "disabled"}}> | ||
<a | ||
href="#" | ||
role="button" | ||
class="page-item" | ||
title="Go to previous page" | ||
aria-label="Go to previous page" | ||
aria-disabled="{{this.disablePrevButtons}}" | ||
aria-current="false" | ||
onclick={{action this.handleNavigation "prev"}} | ||
> | ||
<UiIcon @name="angle-left" /> | ||
</a> | ||
</li> | ||
{{#if (or (not this.hideWhenEmpty) this.pageNumbers.length)}} | ||
<nav aria-label={{this.ariaLabel}}> | ||
<ul class="pagination"> | ||
<li class={{if this.disablePrevButtons "disabled"}}> | ||
<a | ||
href="#" | ||
role="button" | ||
class="page-item" | ||
title="Go to first page" | ||
aria-label="Go to first page" | ||
aria-disabled="{{this.disablePrevButtons}}" | ||
aria-current="false" | ||
onclick={{action this.handleNavigation "first"}} | ||
> | ||
<UiIcon @name="angle-double-left" /> | ||
</a> | ||
</li> | ||
|
||
{{#each this.pageNumbers as |item|}} | ||
<li class="{{if this.disabled "disabled"}}{{if item.isCurrent " active"}}"> | ||
<li class={{if this.disablePrevButtons "disabled"}}> | ||
<a | ||
href="#" | ||
role="button" | ||
class="page-item{{if this.responsive " hidden-xs hidden-sm"}}" | ||
title="{{if item.isCurrent (concat "Current page, page " item.idx) (concat "Go to page " item.idx)}}" | ||
aria-label="{{if item.isCurrent (concat "Current page, page " item.idx) (concat "Go to page " item.idx)}}" | ||
aria-current="{{if item.isCurrent "page" "false"}}" | ||
aria-disabled="{{this.disabled}}" | ||
onclick={{action this.handleNavigation item.idx}} | ||
class="page-item" | ||
title="Go to previous page" | ||
aria-label="Go to previous page" | ||
aria-disabled="{{this.disablePrevButtons}}" | ||
aria-current="false" | ||
onclick={{action this.handleNavigation "prev"}} | ||
> | ||
{{if this.showPageLinkRangeLabels item.range item.idx}} | ||
<UiIcon @name="angle-left" /> | ||
</a> | ||
</li> | ||
{{/each}} | ||
|
||
<li class={{if this.disableNextButtons "disabled"}}> | ||
<a | ||
href="#" | ||
role="button" | ||
class="page-item" | ||
title="Go to next page" | ||
aria-label="Go to next page" | ||
aria-disabled="{{this.disableNextButtons}}" | ||
aria-current="false" | ||
onclick={{action this.handleNavigation "next"}} | ||
> | ||
<UiIcon @name="angle-right" /> | ||
</a> | ||
</li> | ||
{{#each this.pageNumbers as |item|}} | ||
<li class="{{if this.disabled "disabled"}}{{if item.isCurrent " active"}}"> | ||
<a | ||
href="#" | ||
role="button" | ||
class="page-item{{if this.responsive " hidden-xs hidden-sm"}}" | ||
title="{{if item.isCurrent (concat "Current page, page " item.idx) (concat "Go to page " item.idx)}}" | ||
aria-label="{{if item.isCurrent (concat "Current page, page " item.idx) (concat "Go to page " item.idx)}}" | ||
aria-current="{{if item.isCurrent "page" "false"}}" | ||
aria-disabled="{{this.disabled}}" | ||
onclick={{action this.handleNavigation item.idx}} | ||
> | ||
{{if this.showPageLinkRangeLabels item.range item.idx}} | ||
</a> | ||
</li> | ||
{{/each}} | ||
|
||
<li class={{if this.disableNextButtons "disabled"}}> | ||
<a | ||
href="#" | ||
role="button" | ||
class="page-item" | ||
title="Go to next page" | ||
aria-label="Go to next page" | ||
aria-disabled="{{this.disableNextButtons}}" | ||
aria-current="false" | ||
onclick={{action this.handleNavigation "next"}} | ||
> | ||
<UiIcon @name="angle-right" /> | ||
</a> | ||
</li> | ||
|
||
<li class={{if this.disableNextButtons "disabled"}}> | ||
<a | ||
href="#" | ||
role="button" | ||
class="page-item{{if this.disableNextButtons ' disabled'}}" | ||
title="Go to last page" | ||
aria-label="Go to last page" | ||
aria-disabled="{{this.disableNextButtons}}" | ||
aria-current="false" | ||
onclick={{action this.handleNavigation "last"}} | ||
> | ||
<UiIcon @name="angle-double-right" /> | ||
</a> | ||
</li> | ||
</ul> | ||
</nav> | ||
<li class={{if this.disableNextButtons "disabled"}}> | ||
<a | ||
href="#" | ||
role="button" | ||
class="page-item{{if this.disableNextButtons ' disabled'}}" | ||
title="Go to last page" | ||
aria-label="Go to last page" | ||
aria-disabled="{{this.disableNextButtons}}" | ||
aria-current="false" | ||
onclick={{action this.handleNavigation "last"}} | ||
> | ||
<UiIcon @name="angle-double-right" /> | ||
</a> | ||
</li> | ||
</ul> | ||
</nav> | ||
{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters