fix: disable pagination when ahead of last page

This commit is contained in:
trafficlunar 2025-11-12 19:55:43 +00:00
parent 4d0e6188ec
commit 20ac1ea280

View file

@ -79,12 +79,12 @@ export default function Pagination({ lastPage }: Props) {
{/* Next page */} {/* Next page */}
<Link <Link
href={page === lastPage ? "#" : createPageUrl(page + 1)} href={page >= lastPage ? "#" : createPageUrl(page + 1)}
aria-label="Go to Next Page" aria-label="Go to Next Page"
aria-disabled={page === lastPage} aria-disabled={page >= lastPage}
tabIndex={page === lastPage ? -1 : undefined} tabIndex={page >= lastPage ? -1 : undefined}
className={`pill button bg-orange-100! p-0.5! aspect-square text-2xl ${ className={`pill button bg-orange-100! p-0.5! aspect-square text-2xl ${
page === lastPage ? "pointer-events-none opacity-50" : "hover:bg-orange-400!" page >= lastPage ? "pointer-events-none opacity-50" : "hover:bg-orange-400!"
}`} }`}
> >
<Icon icon="stash:chevron-right" /> <Icon icon="stash:chevron-right" />
@ -92,12 +92,12 @@ export default function Pagination({ lastPage }: Props) {
{/* Go to last page */} {/* Go to last page */}
<Link <Link
href={page === lastPage ? "#" : createPageUrl(lastPage)} href={page >= lastPage ? "#" : createPageUrl(lastPage)}
aria-label="Go to Last Page" aria-label="Go to Last Page"
aria-disabled={page === lastPage} aria-disabled={page >= lastPage}
tabIndex={page === lastPage ? -1 : undefined} tabIndex={page >= lastPage ? -1 : undefined}
className={`pill button bg-orange-100! p-0.5! aspect-square text-2xl ${ className={`pill button bg-orange-100! p-0.5! aspect-square text-2xl ${
page === lastPage ? "pointer-events-none opacity-50" : "hover:bg-orange-400!" page >= lastPage ? "pointer-events-none opacity-50" : "hover:bg-orange-400!"
}`} }`}
> >
<Icon icon="stash:chevron-double-right" /> <Icon icon="stash:chevron-double-right" />