import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import { Pagination } from 'antd'

import Style from './style.less'

export default class BodyPagination extends PureComponent {
  static propTypes = {
    storage: PropTypes.object,
    onChange: PropTypes.func,
    configs: PropTypes.object,
  }

  // storage = this.props.storage

  handleChange = (page, pageSize) => {
    if (this.props.onChange) {
      this.props.onChange(page, pageSize)
    }
  }

  render() {
    return (
      <div className={Style['body-paged']}>
        <Pagination
          showSizeChanger
          onChange={this.handleChange}
          onShowSizeChange={this.handleChange} 
          {...(this.props.configs || {})}
        />
      </div>
    )
  }
}
