Skip to content

Commit

Permalink
updated the maxRecordsPage condition
Browse files Browse the repository at this point in the history
  • Loading branch information
SoheshMG committed Jan 27, 2025
1 parent b1905ce commit 92d4381
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions raaghu-elements/src/rds-pagination/rds-pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,16 @@ const RdsPagination = (props: RdsPaginationProps) => {
const dropdownButtonRef = useRef(null);
const maxRecordsPerPage = Math.floor(totalRecords / 2);
const values = [];
for (let i = 10; i <= maxRecordsPerPage; i += 10) {
values.push(i);
}

if (totalRecords < 8) {
for (let i = 1; i < totalRecords; i++) {
values.push(i);
}
} else {
for (let i = Math.floor(maxRecordsPerPage / 4); i <= maxRecordsPerPage && values.length < 4; i += Math.floor(maxRecordsPerPage / 4)) {
values.push(i);
}
}
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
const [dropdownIcon, setDropdownIcon] = useState("chevron_down");

Expand Down

0 comments on commit 92d4381

Please sign in to comment.