ant-design/components/pagination/index.jsx
2016-03-10 10:32:50 +08:00

52 lines
1.1 KiB
JavaScript

import React from 'react';
import Pagination 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;
class AntPagination 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 (
<Pagination selectComponentClass={selectComponentClass}
selectPrefixCls="ant-select"
{...this.props}
locale={locale}
className={className} />
);
}
}
AntPagination.defaultProps = {
locale: zhCN,
className: '',
prefixCls: 'ant-pagination',
};
AntPagination.contextTypes = {
antLocale: React.PropTypes.object,
};
export default AntPagination;