Update pajinasyon with new awtis route

This commit is contained in:
2023-07-22 13:45:55 +04:00
parent ffe3421fa9
commit 7a1ca5bf4f
+8 -28
View File
@@ -1,42 +1,22 @@
'use client'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import {useRouter} from 'next/router' import {useRouter} from 'next/navigation'
import {styled} from '@mui/material/styles'
import Pagination from '@mui/material/Pagination' import Pagination from '@mui/material/Pagination'
import {Grid} from '@mui/material' import Grid from '@mui/material/Unstable_Grid2'
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}) { export default function Pajinasyon({pajTotal, paj}) {
const router = useRouter() const router = useRouter()
const handleChange = (event, value) => { const handleChange = (event, value) => {
const href = `/awtis?paj&paj=${value}` const href = `/awtis?paj=${value}`
const as = `/awtis/paj/${value}` router.push(href)
router.push(href, as)
} }
return ( return (
<StyledGrid container justifyContent='center'> <Grid container sx={{marginBlock: 3}} justifyContent='center'>
<div className={classes.root}>
<Pagination size='small' page={paj} count={pajTotal} color='primary' onChange={handleChange} /> <Pagination size='small' page={paj} count={pajTotal} color='primary' onChange={handleChange} />
</div> </Grid>
</StyledGrid>
) )
} }