import React, { Component } from 'react';
import hoistNonReactStatics from 'hoist-non-react-statics';
import { Pagination as NextPagination } from '@alifd/next';
import { PaginationProps as NextPaginationProps } from '@alifd/next/types/pagination';

interface PaginationProps extends NextPaginationProps {}
class Pagination extends Component<PaginationProps> {
  render() {
    const { type, className } = this.props;
    // mini 模式
    if (type === 'mini') {
      const {
        prefix = 'next-',
        className,
        ...otherProps
      } = this.props;

      return (
        <NextPagination
          {...otherProps}
          type="normal"
          showJump={false}
          prefix={prefix}
          size="small"
          shape="arrow-only"
          className={className}
        />
      );
    }

    return <NextPagination {...this.props} className={className} />;
  }
}

hoistNonReactStatics(Pagination, NextPagination);

export default Pagination;
