This commit is contained in:
louiscklaw
2025-04-22 13:30:02 +08:00
parent 2f28d71060
commit 73a2b2dfb9
5 changed files with 84 additions and 33 deletions

View File

@@ -1,5 +1,8 @@
'use client';
// lesson-categories-pagination.tsx
// RULES:
// T.B.A.
import * as React from 'react';
import TablePagination from '@mui/material/TablePagination';
@@ -10,20 +13,39 @@ function noop(): void {
interface LessonCategoriesPaginationProps {
count: number;
page: number;
//
setPage: (page: number) => void;
setRowsPerPage: (page: number) => void;
rowsPerPage: number;
}
export function LessonCategoriesPagination({ count, page }: LessonCategoriesPaginationProps): React.JSX.Element {
export function LessonCategoriesPagination({
count,
page,
//
setPage,
setRowsPerPage,
rowsPerPage,
}: LessonCategoriesPaginationProps): React.JSX.Element {
// You should implement the pagination using a similar logic as the filters.
// Note that when page change, you should keep the filter search params.
const handleChangePage = (event: unknown, newPage: number) => {
setPage(newPage);
};
const handleChangeRowsPerPage = (event: React.ChangeEvent<HTMLInputElement>) => {
setRowsPerPage(parseInt(event.target.value));
// console.log(parseInt(event.target.value));
};
return (
<TablePagination
component="div"
count={count}
onPageChange={noop}
onRowsPerPageChange={noop}
onPageChange={handleChangePage}
onRowsPerPageChange={handleChangeRowsPerPage}
page={page}
rowsPerPage={5}
rowsPerPage={rowsPerPage}
rowsPerPageOptions={[5, 10, 25]}
/>
);

View File

@@ -1,5 +1,8 @@
'use client';
// lp-categories-pagination.tsx
// RULES:
// T.B.A.
import * as React from 'react';
import TablePagination from '@mui/material/TablePagination';
@@ -7,7 +10,7 @@ function noop(): void {
return undefined;
}
interface LessonCategoriesPaginationProps {
interface LpCategoriesPaginationProps {
count: number;
page: number;
//
@@ -23,7 +26,7 @@ export function LpCategoriesPagination({
setPage,
setRowsPerPage,
rowsPerPage,
}: LessonCategoriesPaginationProps): React.JSX.Element {
}: LpCategoriesPaginationProps): React.JSX.Element {
// You should implement the pagination using a similar logic as the filters.
// Note that when page change, you should keep the filter search params.
const handleChangePage = (event: unknown, newPage: number) => {