Files
pawol.nu/components/awtis/pajinasyon.js
T
Cédric FAMIBELLE-PRONZOLA ed822a49a7 Add ChecheAwtis to page awtis
2022-05-21 17:56:56 +04:00

47 lines
1012 B
JavaScript

import PropTypes from 'prop-types'
import {useRouter} from 'next/router'
import {styled} from '@mui/material/styles'
import Pagination from '@mui/material/Pagination'
import {Grid} from '@mui/material'
const PREFIX = 'pajinasyon'
const classes = {
root: `${PREFIX}-root`
}
const StyledGrid = styled(Grid)((
{
theme
}
) => ({
[`& .${classes.root}`]: {
'& > *': {
marginTop: theme.spacing(2)
}
}
}))
export default function Pajinasyon({pajTotal, paj}) {
const router = useRouter()
const handleChange = (event, value) => {
const href = `/awtis?paj&paj=${value}`
const as = `/awtis/paj/${value}`
router.push(href, as)
}
return (
<StyledGrid container justifyContent='center'>
<div className={classes.root}>
<Pagination size='small' page={paj} count={pajTotal} color='primary' onChange={handleChange} />
</div>
</StyledGrid>
)
}
Pajinasyon.propTypes = {
pajTotal: PropTypes.number.isRequired,
paj: PropTypes.number.isRequired
}