mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-29 05:29:37 +08:00
update simple pagination style
This commit is contained in:
parent
144cca268d
commit
948120e224
@ -1,16 +1,47 @@
|
||||
import React from 'react';
|
||||
import Pagination from 'rc-pagination';
|
||||
import Select from 'rc-select';
|
||||
import Select from '../select';
|
||||
import zhCN from './locale/zh_CN';
|
||||
|
||||
const prefixCls = 'ant-pagination';
|
||||
|
||||
const MiniSelect = React.createClass({
|
||||
render() {
|
||||
return <Select size="small" {...this.props} />;
|
||||
}
|
||||
});
|
||||
|
||||
MiniSelect.Option = Select.Option;
|
||||
|
||||
class AntPagination extends React.Component {
|
||||
render() {
|
||||
let className = this.props.className;
|
||||
|
||||
if (this.props.simple) {
|
||||
// hijiking simple pagination
|
||||
let newProps = {};
|
||||
for (let key in this.props) {
|
||||
if (this.props.hasOwnProperty(key)) {
|
||||
newProps[key] = this.props[key];
|
||||
}
|
||||
}
|
||||
|
||||
delete newProps.simple;
|
||||
|
||||
className += ' mini';
|
||||
|
||||
return <Pagination selectComponentClass={MiniSelect}
|
||||
selectPrefixCls="ant-select"
|
||||
prefixCls={prefixCls}
|
||||
showSizeChanger
|
||||
showQuickJumper
|
||||
{...newProps} className={className}/>;
|
||||
}
|
||||
|
||||
if (this.props.size === 'small') {
|
||||
className += ' mini';
|
||||
}
|
||||
|
||||
return <Pagination selectComponentClass={Select}
|
||||
selectPrefixCls="ant-select"
|
||||
prefixCls={prefixCls}
|
||||
@ -20,6 +51,7 @@ class AntPagination extends React.Component {
|
||||
|
||||
AntPagination.defaultProps = {
|
||||
locale: zhCN,
|
||||
className: '',
|
||||
};
|
||||
|
||||
export default AntPagination;
|
||||
|
Loading…
Reference in New Issue
Block a user