8000 Feat: hide pagination widget when not needed by presleyp · Pull Request #4957 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

Feat: hide pagination widget when not needed #4957

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

Merged
merged 8 commits into from
Nov 8, 2022
Merged
Changes from 1 commit
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
Next Next commit
Hide pagination widget when not needed. Don't merge until count is in.
  • Loading branch information
presleyp committed Nov 7, 2022
commit 5eb62c070196f6a0b65d4c4bf64dfddfb22bd9b3
7 changes: 6 additions & 1 deletion site/src/components/PaginationWidget/PaginationWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,15 @@ export const PaginationWidget = ({

const numPages = numRecords
? Math.ceil(numRecords / numRecordsPerPage)
: undefined
: 0
const firstPageActive = currentPage === 1 && numPages !== 0
const lastPageActive = currentPage === numPages && numPages !== 0

// if beyond page 1, show pagination widget on an empty page so the user can navigate
if (currentPage === 1 && numPages <= 1) {
return null
}

return (
<div style={containerStyle} className={styles.defaultContainerStyles}>
<Button
Expand Down
0