Skip to content

Commit 8d0a9a5

Browse files
authored
Merge pull request #324 from ariefandw/patch-1
Feature: Introduces label and icon options for the first and last buttons in `FwbPagination.vue`. While this goes beyond the standard Flowbite pagination, it offers a valuable customization option for improved user experience.
2 parents 0011452 + 5a63b6e commit 8d0a9a5

File tree

1 file changed

+52
-2
lines changed

1 file changed

+52
-2
lines changed

src/components/FwbPagination/FwbPagination.vue

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,30 @@
2727
:class="getNavigationButtonClasses(1)"
2828
@click="goToFirstPage"
2929
>
30-
First
30+
<slot name="first-icon">
31+
<svg
32+
stroke="currentColor"
33+
fill="none"
34+
stroke-width="0"
35+
viewBox="0 0 20 20"
36+
aria-hidden="true"
37+
class="h-5 w-5"
38+
height="1em"
39+
width="1em"
40+
xmlns="http://www.w3.org/2000/svg"
41+
>
42+
<path
43+
stroke="currentColor"
44+
stroke-linecap="round"
45+
stroke-linejoin="round"
46+
stroke-width="2"
47+
d="m17 14-4-4 4-4m-6 8-4-4 4-4"
48+
/>
49+
</svg>
50+
</slot>
51+
<template v-if="showLabels">
52+
{{ firstLabel }}
53+
</template>
3154
</button>
3255
</slot>
3356

@@ -127,7 +150,30 @@
127150
:class="getNavigationButtonClasses(computedTotalPages)"
128151
@click="goToLastPage"
129152
>
130-
Last
153+
<template v-if="showLabels">
154+
{{ lastLabel }}
155+
</template>
156+
<slot name="last-icon">
157+
<svg
158+
stroke="currentColor"
159+
fill="none"
160+
stroke-width="0"
161+
viewBox="0 0 20 20"
162+
aria-hidden="true"
163+
class="h-5 w-5"
164+
height="1em"
165+
width="1em"
166+
xmlns="http://www.w3.org/2000/svg"
167+
>
168+
<path
169+
stroke="currentColor"
170+
stroke-linecap="round"
171+
stroke-linejoin="round"
172+
stroke-width="2"
173+
d="m7 14 4-4-4-4m6 8 4-4-4-4"
174+
/>
175+
</svg>
176+
</slot>
131177
</button>
132178
</slot>
133179

@@ -156,6 +202,8 @@ interface IPaginationProps {
156202
sliceLength?: number
157203
previousLabel?: string
158204
nextLabel?: string
205+
firstLabel?: string
206+
lastLabel?: string
159207
enableFirstAndLastButtons?: boolean
160208
showLabels?: boolean
161209
large?: boolean
@@ -171,6 +219,8 @@ const props = withDefaults(defineProps<IPaginationProps>(), {
171219
sliceLength: 2,
172220
previousLabel: 'Prev',
173221
nextLabel: 'Next',
222+
firstLabel: 'First',
223+
lastLabel: 'Last',
174224
enableFirstAndLastButtons: false,
175225
showLabels: true,
176226
large: false,

0 commit comments

Comments
 (0)