Update pajinasyon with new awtis route

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