mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-29 13:47:02 +08:00
11c0a6a203
Where necessary, prefix the classes imported from react-component with 'Rc' rather than prefixing the Ant classes with 'Ant'. The prefixing of Ant classes wasn't consistent and isn't necessary in many cases.
50 lines
1.1 KiB
JavaScript
50 lines
1.1 KiB
JavaScript
import React from 'react';
|
|
import RcPagination from 'rc-pagination';
|
|
import Select from '../select';
|
|
import zhCN from './locale/zh_CN';
|
|
|
|
class MiniSelect extends React.Component {
|
|
render() {
|
|
return <Select size="small" {...this.props} />;
|
|
}
|
|
}
|
|
|
|
MiniSelect.Option = Select.Option;
|
|
|
|
export default class Pagination extends React.Component {
|
|
render() {
|
|
let className = this.props.className;
|
|
let selectComponentClass = Select;
|
|
|
|
let locale;
|
|
if (this.context.antLocale && this.context.antLocale.Pagination) {
|
|
locale = this.context.antLocale.Pagination;
|
|
} else {
|
|
locale = this.props.locale;
|
|
}
|
|
|
|
if (this.props.size === 'small') {
|
|
className += ' mini';
|
|
selectComponentClass = MiniSelect;
|
|
}
|
|
|
|
return (
|
|
<RcPagination selectComponentClass={selectComponentClass}
|
|
selectPrefixCls="ant-select"
|
|
{...this.props}
|
|
locale={locale}
|
|
className={className} />
|
|
);
|
|
}
|
|
}
|
|
|
|
Pagination.defaultProps = {
|
|
locale: zhCN,
|
|
className: '',
|
|
prefixCls: 'ant-pagination',
|
|
};
|
|
|
|
Pagination.contextTypes = {
|
|
antLocale: React.PropTypes.object,
|
|
};
|