pagination fixed
This commit is contained in:
parent
bd71b0ae3f
commit
9ee67313f5
@ -18,20 +18,25 @@ export function Pagination({ page, pageSize, total, onPage }: PaginationProps) {
|
||||
const safePage = Math.min(Math.max(page, 1), totalPages);
|
||||
const start = (safePage - 1) * pageSize;
|
||||
|
||||
const handlePageChange = (newPage: number) => {
|
||||
onPage(newPage);
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex items-center justify-between gap-3 border-t border-border-subtle px-[18px] py-3">
|
||||
<div className="flex items-center justify-between gap-3 border-t border-border-subtle px-[18px] pt-4 pb-24">
|
||||
<span className="text-xs text-faint">
|
||||
Showing {start + 1}–{Math.min(start + pageSize, total)} of {total}
|
||||
</span>
|
||||
<div className="flex items-center gap-2">
|
||||
<Button variant="secondary" size="sm" disabled={safePage <= 1} onClick={() => onPage(safePage - 1)}>
|
||||
<Button variant="secondary" size="sm" disabled={safePage <= 1} onClick={() => handlePageChange(safePage - 1)}>
|
||||
<ChevronLeft size={15} />
|
||||
Prev
|
||||
</Button>
|
||||
<span className="px-1 text-xs font-medium text-muted nums">
|
||||
{safePage} / {totalPages}
|
||||
</span>
|
||||
<Button variant="secondary" size="sm" disabled={safePage >= totalPages} onClick={() => onPage(safePage + 1)}>
|
||||
<Button variant="secondary" size="sm" disabled={safePage >= totalPages} onClick={() => handlePageChange(safePage + 1)}>
|
||||
Next
|
||||
<ChevronRight size={15} />
|
||||
</Button>
|
||||
|
||||
@ -54,7 +54,7 @@ export function RecordView({
|
||||
rvUid,
|
||||
title = 'Records',
|
||||
columns,
|
||||
pageSize = 50,
|
||||
pageSize = 20,
|
||||
onRowClick,
|
||||
rowKey,
|
||||
headerActions,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user