ignore folder
This commit is contained in:
29
components/ui/Pagination.tsx
Normal file
29
components/ui/Pagination.tsx
Normal file
@ -0,0 +1,29 @@
|
||||
type PaginationProps = {
|
||||
page: number;
|
||||
pageSize: number;
|
||||
total: number;
|
||||
onChange: (page: number) => void;
|
||||
};
|
||||
|
||||
export default function Pagination({ page, pageSize, total, onChange }: PaginationProps) {
|
||||
const totalPages = Math.max(1, Math.ceil(total / pageSize));
|
||||
if (totalPages <= 1) return null;
|
||||
|
||||
return (
|
||||
<div className="d-flex justify-content-center gap-1">
|
||||
<button className="btn btn-outline-secondary btn-sm" disabled={page <= 1} onClick={() => onChange(page - 1)}>
|
||||
Prev
|
||||
</button>
|
||||
<span className="px-2 d-flex align-items-center">
|
||||
Page {page} / {totalPages}
|
||||
</span>
|
||||
<button
|
||||
className="btn btn-outline-secondary btn-sm"
|
||||
disabled={page >= totalPages}
|
||||
onClick={() => onChange(page + 1)}
|
||||
>
|
||||
Next
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user