Skip to content

Commit

Permalink
fix(table-pagination): remove table pagination when there's not enoug…
Browse files Browse the repository at this point in the history
…h data
  • Loading branch information
sijav committed Dec 12, 2023
1 parent ca7d6ac commit 0623cd7
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -24,9 +26,9 @@ export const TablePagination = ({ dataCount, page, rowsPerPage, setPage, setRows
setPage(0)
}

return (
return dataCount < ROWS_PER_PAGE_OPTIONS[0] ? null : (
<MuiTablePagination
rowsPerPageOptions={[10, 25, 50, 100]}
rowsPerPageOptions={ROWS_PER_PAGE_OPTIONS}
component="div"
labelDisplayedRows={dataCount < 0 ? () => `${page * rowsPerPage} - ${page * rowsPerPage + rowsPerPage}` : undefined}
count={dataCount}
Expand Down

0 comments on commit 0623cd7

Please sign in to comment.