Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add paginationComponentOptions.minWindowWidth (defaults to SMALL == 599) #1227

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/DataTable/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ function Pagination({
}: PaginationProps): JSX.Element {
const windowSize = useWindowSize();
const isRTL = useRTL(direction);
const shouldShow = windowSize.width && windowSize.width > SMALL;
const { minWindowWidth = SMALL } = paginationComponentOptions;
const windowWidth = windowSize.width;
const shouldShow = !minWindowWidth || (windowWidth && windowWidth > minWindowWidth);
// const isRTL = detectRTL(direction);
const numPages = getNumberOfPages(rowCount, rowsPerPage);
const lastIndex = currentPage * rowsPerPage;
Expand Down
4 changes: 4 additions & 0 deletions src/DataTable/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ export interface TableStyles {

export interface PaginationOptions {
noRowsPerPage?: boolean;
// If non-null, the "rows per page" dropdown will be hidden when the window width is less than
// this value. SMALL == 599 is the default (if this property is undefined); pass `null` to always
// show the dropdown (useful for ensuring SSR matches client).
minWindowWidth?: number | null;
rowsPerPageText?: string;
rangeSeparatorText?: string;
selectAllRowsItem?: boolean;
Expand Down