Skip to content

Commit 93d7e43

Browse files
committed
fix: update button disabling logic
1 parent 14925e7 commit 93d7e43

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

site/src/components/PaginationWidget/PaginationWidgetBase.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ export const PaginationWidgetBase = ({
2121
}: PaginationWidgetBaseProps): JSX.Element | null => {
2222
const theme = useTheme();
2323
const isMobile = useMediaQuery(theme.breakpoints.down("md"));
24-
const numPages = Math.ceil(count / limit);
25-
const isFirstPage = page === 0;
26-
const isLastPage = page === numPages - 1;
2724

25+
const numPages = Math.ceil(count / limit);
2826
if (numPages < 2) {
2927
return null;
3028
}
3129

30+
const isFirstPage = page <= 1;
31+
const isLastPage = page >= numPages;
32+
3233
return (
3334
<div
3435
css={{
@@ -79,6 +80,7 @@ export const PaginationWidgetBase = ({
7980
);
8081
})
8182
)}
83+
8284
<Button
8385
aria-label="Next page"
8486
disabled={isLastPage}

0 commit comments

Comments
 (0)