forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDropdownMenu.jsx
43 lines (36 loc) · 1013 Bytes
/
DropdownMenu.jsx
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
38
39
40
41
42
43
/** @jsx React.DOM */
import React from './react-es6';
import classSet from './react-es6/lib/cx';
import utils from './utils';
var DropdownMenu = React.createClass({
propTypes: {
pullRight: React.PropTypes.bool,
onSelect: React.PropTypes.func
},
render: function () {
var classes = {
'dropdown-menu': true,
'dropdown-menu-right': this.props.pullRight
};
return this.transferPropsTo(
<ul
className={classSet(classes)}
role="menu">
{utils.modifyChildren(this.props.children, this.renderMenuItem)}
</ul>
);
},
renderMenuItem: function (child) {
return utils.cloneWithProps(
child,
{
// Capture onSelect events
onSelect: utils.createChainedFunction(child.props.onSelect, this.props.onSelect),
// Force special props to be transferred
key: child.props.key,
ref: child.props.ref
}
);
}
});
export default = DropdownMenu;