Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 2966 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
2964 stevensc 1
import React from 'react'
2965 stevensc 2
import { Pagination as MuiPagination, styled } from '@mui/material'
2964 stevensc 3
 
2965 stevensc 4
const StyledPagination = styled(MuiPagination)(({ theme }) => ({
5
  padding: theme.spacing(0, 1),
6
  '.MuiPagination-ul': {
7
    width: '100%',
8
    display: 'flex',
9
    alignItems: 'center',
10
    justifyContent: 'space-around',
11
    gap: theme.spacing(0.5)
2967 stevensc 12
  },
13
  '.MuiPaginationItem-root': {
14
    borderRadius: '65%',
15
    height: '30px',
16
    width: '30px'
2965 stevensc 17
  }
18
}))
19
 
2964 stevensc 20
const Pagination = ({ pages = 1, page = 1, onChange = () => {} }) => {
21
  const currentPage = Number(page) || 1
22
 
23
  const handleChange = (event, value) => onChange(value)
24
 
25
  if (pages <= 1) {
26
    return null
27
  }
28
 
29
  return (
2965 stevensc 30
    <StyledPagination
31
      count={pages}
32
      page={currentPage}
33
      onChange={handleChange}
2966 stevensc 34
      variant='outlined'
35
      color='secondary'
2965 stevensc 36
    />
2964 stevensc 37
  )
38
}
39
 
40
export default Pagination