import React from 'react' import { useTheme } from '@mui/material/styles'; import Box from '@mui/material/Box'; import IconButton from '@mui/material/IconButton'; import {MdLastPage, MdFirstPage, MdKeyboardArrowLeft, MdKeyboardArrowRight} from "react-icons/md"; import { StyledPagination, StyledTablePagination } from './styles'; import Stack from '@mui/material/Stack'; interface PaginationProps { isTablePagination?: boolean, rowsPerPageOptions?: Array, colSpan?: number, count?: number, rowsPerPage?: number, page?: number, SelectProps?: any, boundaryCount?: number, color?: 'primary'| 'secondary'| 'standard', defaultPage?: number, disabled?: boolean, hideNextButton?: boolean, hidePrevButton?: boolean, shape?: 'circular'| 'rounded', showFirstButton?: boolean, showLastButton?: boolean, siblingCount?: number, size?: 'small'| 'medium'| 'large', variant?: 'outlined'| 'text', sx?: any, setPage?: React.Dispatch> setRowsPerPage?: React.Dispatch> } interface TablePaginationActionsProps { count: number; page: number; rowsPerPage: number; onPageChange: ( event: React.MouseEvent, newPage: number, ) => void; } function TablePaginationActions(props: TablePaginationActionsProps) { const theme = useTheme(); const { count, page, rowsPerPage, onPageChange } = props; const handleFirstPageButtonClick = ( event: React.MouseEvent, ) => { onPageChange(event, 0); }; const handleBackButtonClick = (event: React.MouseEvent) => { onPageChange(event, page - 1); }; const handleNextButtonClick = (event: React.MouseEvent) => { onPageChange(event, page + 1); }; const handleLastPageButtonClick = (event: React.MouseEvent) => { onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1)); }; return ( {theme.direction === 'rtl' ? : } {theme.direction === 'rtl' ? : } = Math.ceil(count / rowsPerPage) - 1} aria-label="next page" > {theme.direction === 'rtl' ? : } = Math.ceil(count / rowsPerPage) - 1} aria-label="last page" > {theme.direction === 'rtl' ? : } ); } const Pagination = ({isTablePagination,rowsPerPageOptions,colSpan,count=0,rowsPerPage=0,page=0,SelectProps,setPage=() => {},setRowsPerPage=() => {}, ...other}:PaginationProps) => { const handleChangePage = ( event: React.MouseEvent | unknown, newPage: number, ) => { setPage(newPage); }; const handleChangeRowsPerPage = ( event: React.ChangeEvent, ) => { setRowsPerPage(+event.target.value); }; return ( <> { isTablePagination ? : } ) } export default Pagination;