fix: next button disabled state in paginated rows view

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9791
GitOrigin-RevId: 953433a8c4bc3dfddb38a141c5e7d079a6da3618
This commit is contained in:
Luca Restagno 2023-07-07 12:02:03 +02:00 committed by hasura-bot
parent 7d35304816
commit 7f2fa266e6

View File

@ -1,4 +1,3 @@
import React from 'react';
import { Button } from '../Button';
import { inputStyles } from '../../components/Services/Events/constants';
@ -13,6 +12,7 @@ export type PaginationWithOnlyNavProps = {
export const PaginationWithOnlyNav = (props: PaginationWithOnlyNavProps) => {
const { offset, limit, changePage, changePageSize, rows } = props;
const newPage = offset / limit;
const isNextEnabled = rows.length === limit;
return (
<div className="flex ml-sm mr-sm mb-sm mt-sm justify-around max-w-5xl">
<div>
@ -48,7 +48,7 @@ export const PaginationWithOnlyNav = (props: PaginationWithOnlyNavProps) => {
<div>
<Button
onClick={() => changePage(newPage + 1)}
disabled={rows.length === 0}
disabled={rows.length === 0 || !isNextEnabled}
data-test="custom-pagination-next"
>
Next