forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDropdownButton.js
More file actions
53 lines (43 loc) · 1.11 KB
/
DropdownButton.js
File metadata and controls
53 lines (43 loc) · 1.11 KB
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
44
45
46
47
48
49
50
51
52
53
import React from 'react';
import Dropdown from './Dropdown';
import splitComponentProps from './utils/splitComponentProps';
const propTypes = {
...Dropdown.propTypes,
// Toggle props.
bsStyle: React.PropTypes.string,
bsSize: React.PropTypes.string,
title: React.PropTypes.node.isRequired,
noCaret: React.PropTypes.bool,
// Override generated docs from <Dropdown>.
/**
* @private
*/
children: React.PropTypes.node,
};
class DropdownButton extends React.Component {
render() {
const { bsSize, bsStyle, title, children, ...props } = this.props;
const [dropdownProps, toggleProps] =
splitComponentProps(props, Dropdown.ControlledComponent);
return (
<Dropdown
{...dropdownProps}
bsSize={bsSize}
bsStyle={bsStyle}
>
<Dropdown.Toggle
{...toggleProps}
bsSize={bsSize}
bsStyle={bsStyle}
>
{title}
</Dropdown.Toggle>
<Dropdown.Menu>
{children}
</Dropdown.Menu>
</Dropdown>
);
}
}
DropdownButton.propTypes = propTypes;
export default DropdownButton;