Browse Source

Merge pull request #633 from ant-design/update-simple-pagination

Update simple pagination
pull/653/head
afc163 9 years ago
parent
commit
462f4432d7
  1. 8
      components/pagination/demo/mini.md
  2. 22
      components/pagination/index.jsx
  3. 2
      style/components/select.less

8
components/pagination/demo/mini.md

@ -9,7 +9,9 @@
````jsx ````jsx
import { Pagination } from 'antd'; import { Pagination } from 'antd';
ReactDOM.render( ReactDOM.render(<div>
<Pagination size="small" defaultCurrent={2} total={50} />, <Pagination size="small" total={50} />
document.getElementById('components-pagination-demo-mini')); <br />
<Pagination size="small" total={50} showSizeChanger showQuickJumper />
</div>, document.getElementById('components-pagination-demo-mini'));
```` ````

22
components/pagination/index.jsx

@ -1,25 +1,37 @@
import React from 'react'; import React from 'react';
import Pagination from 'rc-pagination'; import Pagination from 'rc-pagination';
import Select from 'rc-select'; import Select from '../select';
import zhCN from './locale/zh_CN'; import zhCN from './locale/zh_CN';
const prefixCls = 'ant-pagination'; class MiniSelect extends React.Component {
render() {
return <Select size="small" {...this.props} />;
}
}
MiniSelect.Option = Select.Option;
class AntPagination extends React.Component { class AntPagination extends React.Component {
render() { render() {
let className = this.props.className; let className = this.props.className;
let selectComponentClass = Select;
if (this.props.size === 'small') { if (this.props.size === 'small') {
className += ' mini'; className += ' mini';
selectComponentClass = MiniSelect;
} }
return <Pagination selectComponentClass={Select}
return <Pagination selectComponentClass={selectComponentClass}
selectPrefixCls="ant-select" selectPrefixCls="ant-select"
prefixCls={prefixCls} {...this.props}
{...this.props} className={className}/>; className={className} />;
} }
} }
AntPagination.defaultProps = { AntPagination.defaultProps = {
locale: zhCN, locale: zhCN,
className: '',
prefixCls: 'ant-pagination',
}; };
export default AntPagination; export default AntPagination;

2
style/components/select.less

@ -105,7 +105,7 @@
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
padding-left: 10px; padding-left: 8px;
padding-right: 24px; padding-right: 24px;
line-height: 26px; line-height: 26px;
} }

Loading…
Cancel
Save