Skip to content

feat: Add label and icon for first and last buttons in FwbPagination.vue #324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 14-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 14 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