forked from react-bootstrap/react-bootstrap-bower
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPager.js
37 lines (31 loc) · 1004 Bytes
/
Pager.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
define(function (require, exports, module) {var React = require('react');
var joinClasses = require('./utils/joinClasses');
var cloneWithProps = require('./utils/cloneWithProps');
var ValidComponentChildren = require('./utils/ValidComponentChildren');
var createChainedFunction = require('./utils/createChainedFunction');
var Pager = React.createClass({displayName: 'Pager',
propTypes: {
onSelect: React.PropTypes.func
},
render: function () {
return (
React.createElement("ul", React.__spread({},
this.props,
{className: joinClasses(this.props.className, 'pager')}),
ValidComponentChildren.map(this.props.children, this.renderPageItem)
)
);
},
renderPageItem: function (child, index) {
return cloneWithProps(
child,
{
onSelect: createChainedFunction(child.props.onSelect, this.props.onSelect),
ref: child.ref,
key: child.key ? child.key : index
}
);
}
});
module.exports = Pager;
});