Disable buttons if reached limits but not infinite
This commit is contained in:
@@ -4,10 +4,16 @@
|
|||||||
* Indicates direction of the arrow ('next', 'prev')
|
* Indicates direction of the arrow ('next', 'prev')
|
||||||
*/
|
*/
|
||||||
export let direction = NEXT
|
export let direction = NEXT
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if button disabled
|
||||||
|
*/
|
||||||
|
export let disabled = false
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="circle"
|
class="circle"
|
||||||
|
class:disabled
|
||||||
on:click
|
on:click
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
@@ -49,4 +55,8 @@
|
|||||||
transform: rotate(135deg);
|
transform: rotate(135deg);
|
||||||
right: calc(var(--size) / -2);
|
right: calc(var(--size) / -2);
|
||||||
}
|
}
|
||||||
|
.disabled,
|
||||||
|
.disabled:hover {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -173,7 +173,11 @@
|
|||||||
{#if arrows}
|
{#if arrows}
|
||||||
<slot name="prev" {showPrevPage}>
|
<slot name="prev" {showPrevPage}>
|
||||||
<div class="arrow-container">
|
<div class="arrow-container">
|
||||||
<Arrow direction="prev" on:click={showPrevPage} />
|
<Arrow
|
||||||
|
direction="prev"
|
||||||
|
disabled={!infinite && originalCurrentPageIndex === 0}
|
||||||
|
on:click={showPrevPage}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</slot>
|
</slot>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -199,7 +203,11 @@
|
|||||||
{#if arrows}
|
{#if arrows}
|
||||||
<slot name="next" {showNextPage}>
|
<slot name="next" {showNextPage}>
|
||||||
<div class="arrow-container">
|
<div class="arrow-container">
|
||||||
<Arrow direction="next" on:click={showNextPage} />
|
<Arrow
|
||||||
|
direction="next"
|
||||||
|
disabled={!infinite && originalCurrentPageIndex === originalPagesCount - 1}
|
||||||
|
on:click={showNextPage}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</slot>
|
</slot>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Reference in New Issue
Block a user