diff --git a/src/features/category/ui/AllProduct.tsx b/src/features/category/ui/AllProduct.tsx index 10c704d..ff20cc0 100644 --- a/src/features/category/ui/AllProduct.tsx +++ b/src/features/category/ui/AllProduct.tsx @@ -100,7 +100,7 @@ const AllProducts = () => {
diff --git a/src/shared/ui/global-pagination.tsx b/src/shared/ui/global-pagination.tsx index 525a89c..24b0150 100644 --- a/src/shared/ui/global-pagination.tsx +++ b/src/shared/ui/global-pagination.tsx @@ -6,7 +6,7 @@ import { Button } from './button'; type GlobalPaginationProps = { page: number; total: number; - pageSize?: number; + pageSize: number; onChange: (page: number) => void; }; @@ -23,7 +23,7 @@ const getPages = (current: number, total: number) => { 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); for (let i = start; i <= end; i++) { @@ -42,7 +42,7 @@ const getPages = (current: number, total: number) => { export const GlobalPagination = ({ page, total, - pageSize = 36, + pageSize, onChange, }: GlobalPaginationProps) => { const totalPages = Math.ceil(total / pageSize);