forked from react-bootstrap/react-bootstrap-bower
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathListGroup.js
32 lines (26 loc) · 901 Bytes
/
ListGroup.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
define(function (require, exports, module) {var React = require('react');
var classSet = require('./utils/classSet');
var cloneWithProps = require('./utils/cloneWithProps');
var ValidComponentChildren = require('./utils/ValidComponentChildren');
var createChainedFunction = require('./utils/createChainedFunction');
var ListGroup = React.createClass({displayName: 'ListGroup',
propTypes: {
onClick: React.PropTypes.func
},
render: function () {
return (
React.createElement("div", {className: "list-group"},
ValidComponentChildren.map(this.props.children, this.renderListItem)
)
);
},
renderListItem: function (child, index) {
return cloneWithProps(child, {
onClick: createChainedFunction(child.props.onClick, this.props.onClick),
ref: child.ref,
key: child.key ? child.key : index
});
}
});
module.exports = ListGroup;
});