Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | 5x 66x 66x 66x | /**
* CompanyPagination Component
*
* Reusable pagination controls for company list
* - Page navigation with first/last buttons
* - Items per page selector
* - Responsive layout
*/
import React from 'react';
import {
Box,
Pagination,
FormControl,
Select,
MenuItem,
Typography,
SelectChangeEvent,
} from '@mui/material';
import { useTranslation } from 'react-i18next';
interface CompanyPaginationProps {
page: number;
totalPages: number;
limit: number;
onPageChange: (page: number) => void;
onLimitChange: (limit: number) => void;
}
const CompanyPagination: React.FC<CompanyPaginationProps> = ({
page,
totalPages,
limit,
onPageChange,
onLimitChange,
}) => {
const { t } = useTranslation('common');
const handleLimitChange = (event: SelectChangeEvent<number>) => {
const newLimit = Number(event.target.value);
onLimitChange(newLimit);
};
return (
<Box
sx={{
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
mt: 3,
flexWrap: 'wrap',
gap: 2,
}}
>
{/* Pagination Controls */}
<Pagination
count={totalPages}
page={page}
onChange={(_, newPage) => onPageChange(newPage)}
color="primary"
showFirstButton
showLastButton
siblingCount={1}
boundaryCount={1}
/>
{/* Items Per Page Selector */}
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
<Typography variant="body2" color="text.secondary" id="items-per-page-label">
{t('company.pagination.itemsPerPage')}:
</Typography>
<FormControl size="small">
<Select
value={limit}
onChange={handleLimitChange}
aria-labelledby="items-per-page-label"
inputProps={{
'aria-label': t('company.pagination.itemsPerPage'),
}}
>
<MenuItem value={10}>10</MenuItem>
<MenuItem value={20}>20</MenuItem>
<MenuItem value={50}>50</MenuItem>
<MenuItem value={100}>100</MenuItem>
</Select>
</FormControl>
</Box>
</Box>
);
};
export default CompanyPagination;
|