🚸(frontend) disable pagination controls at first and last pages

Disable previous/next pagination controls when users are on the first or
last page respectively to prevent offering non-functional interactions.

Improves user experience by clearly indicating when navigation options
are unavailable and preventing confusion from inactive controls that
appear interactive.
This commit is contained in:
lebaudantoine
2025-09-05 11:44:37 +02:00
committed by aleb_the_flash
parent 0bf7755855
commit 47cc88c820
2 changed files with 8 additions and 0 deletions

View File

@@ -44,6 +44,8 @@ export function PaginationControl({
} }
}, [connectedElement]) }, [connectedElement])
if (totalPageCount <= 1) return null
return ( return (
<div <div
className={css({ className={css({
@@ -66,6 +68,7 @@ export function PaginationControl({
data-lk-user-interaction={interactive} data-lk-user-interaction={interactive}
> >
<Button <Button
isDisabled={currentPage == 1}
onPress={prevPage} onPress={prevPage}
size="xs" size="xs"
variant="quaternaryText" variant="quaternaryText"
@@ -85,6 +88,7 @@ export function PaginationControl({
})} })}
</span> </span>
<Button <Button
isDisabled={currentPage == totalPageCount}
onPress={nextPage} onPress={nextPage}
size="xs" size="xs"
variant="quaternaryText" variant="quaternaryText"

View File

@@ -205,6 +205,10 @@ export const buttonRecipe = cva({
backgroundColor: 'greyscale.100', backgroundColor: 'greyscale.100',
color: 'greyscale.700', color: 'greyscale.700',
}, },
'&[data-disabled]': {
backgroundColor: 'transparent',
color: 'greyscale.300',
},
}, },
greyscale: { greyscale: {
backgroundColor: 'transparent', backgroundColor: 'transparent',