Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 2965 | Rev 2967 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

import React from 'react'
import { Pagination as MuiPagination, styled } from '@mui/material'

const StyledPagination = styled(MuiPagination)(({ theme }) => ({
  padding: theme.spacing(0, 1),
  '.MuiPagination-ul': {
    width: '100%',
    display: 'flex',
    alignItems: 'center',
    justifyContent: 'space-around',
    gap: theme.spacing(0.5)
  }
}))

const Pagination = ({ pages = 1, page = 1, onChange = () => {} }) => {
  const currentPage = Number(page) || 1

  const handleChange = (event, value) => onChange(value)

  if (pages <= 1) {
    return null
  }

  return (
    <StyledPagination
      count={pages}
      page={currentPage}
      onChange={handleChange}
      variant='outlined'
      color='secondary'
    />
  )
}

export default Pagination