import React from 'react'
import { Table } from 'antd'

export default props => {
  const { onPageChange, pagination = {}, ...leftProps } = props

  const pgSetting = {
    ...props.pagination,
    onChange: (page, pageSize) => {
      if (props.onPageChange) {
        props.onPageChange(page, pageSize)
      }
    }
  }

  return (
    <Table
      {...leftProps}
      pagination={pgSetting}
    >
      {props.children}
    </Table>
  )
}
