Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 2964 | 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
import colors from '@styles/colors'
5
 
6
const StyledPagination = styled(MuiPagination)(({ theme }) => ({
7
  padding: theme.spacing(0, 1),
8
  '.MuiPagination-ul': {
9
    width: '100%',
10
    display: 'flex',
11
    alignItems: 'center',
12
    justifyContent: 'space-around',
13
    gap: theme.spacing(0.5)
14
  },
15
  '.MuiPaginationItem-root': {
16
    backgroundColor: colors.main
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}
34
    />
2964 stevensc 35
  )
36
}
37
 
38
export default Pagination