ant-design/components/pagination/index.jsx

40 lines
854 B
React
Raw Normal View History

import React from 'react';
import Pagination from 'rc-pagination';
2015-12-04 14:19:06 +08:00
import Select from '../select';
2015-11-16 14:10:42 +08:00
import zhCN from './locale/zh_CN';
2015-07-13 01:04:05 +08:00
2015-12-04 14:37:30 +08:00
class MiniSelect extends React.Component {
2015-12-04 14:19:06 +08:00
render() {
return <Select size="small" {...this.props} />;
}
2015-12-04 14:37:30 +08:00
}
2015-12-04 14:19:06 +08:00
MiniSelect.Option = Select.Option;
2015-11-16 14:10:42 +08:00
class AntPagination extends React.Component {
2015-07-13 01:04:05 +08:00
render() {
let className = this.props.className;
2015-12-05 13:34:55 +08:00
let selectComponentClass = Select;
2015-12-04 14:19:06 +08:00
if (this.props.size === 'small') {
className += ' mini';
2015-12-05 13:34:55 +08:00
selectComponentClass = MiniSelect;
}
2015-12-04 14:19:06 +08:00
return (
<Pagination selectComponentClass={selectComponentClass}
selectPrefixCls="ant-select"
{...this.props}
className={className} />
);
2015-07-13 01:04:05 +08:00
}
}
2015-11-16 14:10:42 +08:00
AntPagination.defaultProps = {
locale: zhCN,
2015-12-04 14:19:06 +08:00
className: '',
2015-12-05 13:34:55 +08:00
prefixCls: 'ant-pagination',
2015-11-16 14:10:42 +08:00
};
export default AntPagination;