Skip to content

Commit

Permalink
feat: Label and Icon added for Pagination first and last button
Browse files Browse the repository at this point in the history
  • Loading branch information
ariefandw authored Sep 14, 2024
1 parent c679aa9 commit a75e844
Showing 1 changed file with 52 additions and 2 deletions.
54 changes: 52 additions & 2 deletions src/components/FwbPagination/FwbPagination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,30 @@
:class="getNavigationButtonClasses(1)"
@click="goToFirstPage"
>
First
<slot name="first-icon">
<svg
stroke="currentColor"
fill="none"
stroke-width="0"
viewBox="0 0 20 20"
aria-hidden="true"
class="h-5 w-5"
height="1em"
width="1em"
xmlns="http://www.w3.org/2000/svg"
>
<path
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="m17 16-4-4 4-4m-6 8-4-4 4-4"
/>
</svg>
</slot>
<template v-if="showLabels">
{{ firstLabel }}
</template>
</button>
</slot>

Expand Down Expand Up @@ -127,7 +150,30 @@
:class="getNavigationButtonClasses(computedTotalPages)"
@click="goToLastPage"
>
Last
<template v-if="showLabels">
{{ lastLabel }}
</template>
<slot name="last-icon">
<svg
stroke="currentColor"
fill="none"
stroke-width="0"
viewBox="0 0 20 20"
aria-hidden="true"
class="h-5 w-5"
height="1em"
width="1em"
xmlns="http://www.w3.org/2000/svg"
>
<path
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="m7 16 4-4-4-4m6 8 4-4-4-4"
/>
</svg>
</slot>
</button>
</slot>

Expand Down Expand Up @@ -155,6 +201,8 @@ interface IPaginationProps {
sliceLength?: number
previousLabel?: string
nextLabel?: string
firstLabel?: string
lastLabel?: string
enableFirstAndLastButtons?: boolean
showLabels?: boolean
large?: boolean
Expand All @@ -170,6 +218,8 @@ const props = withDefaults(defineProps<IPaginationProps>(), {
sliceLength: 2,
previousLabel: 'Prev',
nextLabel: 'Next',
firstLabel: 'First',
lastLabel: 'Last',
enableFirstAndLastButtons: false,
showLabels: true,
large: false,
Expand Down

0 comments on commit a75e844

Please sign in to comment.