fix
This commit is contained in:
@@ -100,7 +100,7 @@ const AllProducts = () => {
|
|||||||
<div className="w-full mt-5 flex justify-end">
|
<div className="w-full mt-5 flex justify-end">
|
||||||
<GlobalPagination
|
<GlobalPagination
|
||||||
page={page}
|
page={page}
|
||||||
total={product.total ?? 0}
|
total={product.total}
|
||||||
pageSize={PAGE_SIZE}
|
pageSize={PAGE_SIZE}
|
||||||
onChange={handlePageChange}
|
onChange={handlePageChange}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { Button } from './button';
|
|||||||
type GlobalPaginationProps = {
|
type GlobalPaginationProps = {
|
||||||
page: number;
|
page: number;
|
||||||
total: number;
|
total: number;
|
||||||
pageSize?: number;
|
pageSize: number;
|
||||||
onChange: (page: number) => void;
|
onChange: (page: number) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ const getPages = (current: number, total: number) => {
|
|||||||
pages.push('dots');
|
pages.push('dots');
|
||||||
}
|
}
|
||||||
|
|
||||||
const start = Math.min(2, current - 1);
|
const start = Math.max(2, current - 1);
|
||||||
const end = Math.min(total - 1, current + 1);
|
const end = Math.min(total - 1, current + 1);
|
||||||
|
|
||||||
for (let i = start; i <= end; i++) {
|
for (let i = start; i <= end; i++) {
|
||||||
@@ -42,7 +42,7 @@ const getPages = (current: number, total: number) => {
|
|||||||
export const GlobalPagination = ({
|
export const GlobalPagination = ({
|
||||||
page,
|
page,
|
||||||
total,
|
total,
|
||||||
pageSize = 36,
|
pageSize,
|
||||||
onChange,
|
onChange,
|
||||||
}: GlobalPaginationProps) => {
|
}: GlobalPaginationProps) => {
|
||||||
const totalPages = Math.ceil(total / pageSize);
|
const totalPages = Math.ceil(total / pageSize);
|
||||||
|
|||||||
Reference in New Issue
Block a user