All files / components/pagination page.js

0% Statements 0/16
0% Branches 0/6
0% Functions 0/4
0% Lines 0/9
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22                                           
import React from 'react'
import PropTypes from 'prop-types'
 
const Dots = () => <span>...</span>
 
const Page = ({ page, onClick }) => {
  const Component = page === '...' ? Dots : 'div'
 
  return (
    <Component onClick={() => onClick(page)}>
      {page}
    </Component>
  )
}
 
Page.propTypes = {
  page: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
  onClick: PropTypes.func
}
 
export default Page