From 0623cd76cd411e9b32e864444385e73467bcd6a5 Mon Sep 17 00:00:00 2001 From: Sina Javaheri Date: Tue, 12 Dec 2023 12:23:15 +0100 Subject: [PATCH] fix(table-pagination): remove table pagination when there's not enough data --- .../panel-layout/table-view-page/TablePagination.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/shared/layouts/panel-layout/table-view-page/TablePagination.tsx b/src/shared/layouts/panel-layout/table-view-page/TablePagination.tsx index ccc25c5a..b6a521be 100644 --- a/src/shared/layouts/panel-layout/table-view-page/TablePagination.tsx +++ b/src/shared/layouts/panel-layout/table-view-page/TablePagination.tsx @@ -11,6 +11,8 @@ export interface TablePaginationProps { name?: string } +const ROWS_PER_PAGE_OPTIONS = [10, 25, 50, 100] + export const TablePagination = ({ dataCount, page, rowsPerPage, setPage, setRowsPerPage, name }: TablePaginationProps) => { const tableContainerRef = useTableViewPageScroll() @@ -24,9 +26,9 @@ export const TablePagination = ({ dataCount, page, rowsPerPage, setPage, setRows setPage(0) } - return ( + return dataCount < ROWS_PER_PAGE_OPTIONS[0] ? null : ( `${page * rowsPerPage} - ${page * rowsPerPage + rowsPerPage}` : undefined} count={dataCount}