Skip to content

Commit

Permalink
klink siblings with boundries
Browse files Browse the repository at this point in the history
  • Loading branch information
Snorre98 committed Nov 6, 2024
1 parent 7cf16ee commit b93b292
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions frontend/src/Components/Pagination/DrfPagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ interface DRFPaginationProps {
totalItems: number;
pageSize: number;
onPageChange: (page: number) => void;
siblingCount?: number; // New prop to control sibling pages
boundaryCount?: number; // New prop to control boundary pages
siblingCount?: number; // Controls the number of sibling pages around the current page
boundaryCount?: number; // Controls the number of boundary pages on each end
className?: string;
itemClassName?: string;
}
Expand All @@ -21,11 +21,11 @@ const generateSequentialPages = (start: number, end: number): number[] => {
return Array.from({ length: end - start + 1 }, (_, i) => start + i);
};

// Helper function to determine if ellipsis is needed
// Adjusted ellipsis helper functions
const showStartEllipsis = (current: number, boundaryCount: number, siblingCount: number): boolean =>
boundaryCount > 0 && siblingCount > 0 && current > boundaryCount + 1;
boundaryCount > 0 && siblingCount > 0 && current > boundaryCount + siblingCount + 1;
const showEndEllipsis = (current: number, total: number, boundaryCount: number, siblingCount: number): boolean =>
boundaryCount > 0 && siblingCount > 0 && current < total - boundaryCount;
boundaryCount > 0 && siblingCount > 0 && current < total - boundaryCount - siblingCount;

export const DrfPagination: React.FC<DRFPaginationProps> = ({
currentPage,
Expand Down

0 comments on commit b93b292

Please sign in to comment.