File tree 2 files changed +34
-19
lines changed
2 files changed +34
-19
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import Dropdown from './Dropdown' ;
3
3
import omit from 'lodash-compat/object/omit' ;
4
+ import pick from 'lodash-compat/object/pick' ;
4
5
import Button from './Button' ;
5
6
6
7
class DropdownButton extends React . Component {
7
8
8
9
render ( ) {
9
- let { title, ...props } = this . props ;
10
+ let { bsStyle, bsSize, disabled } = this . props ;
11
+ let { title, children, ...props } = this . props ;
10
12
11
- let toggleProps = omit ( props , Dropdown . ControlledComponent . propTypes ) ;
13
+ let dropdownProps = pick ( props , Object . keys ( Dropdown . ControlledComponent . propTypes ) ) ;
14
+ let toggleProps = omit ( props , Object . keys ( Dropdown . ControlledComponent . propTypes ) ) ;
12
15
13
16
return (
14
- < Dropdown { ...props } >
15
- < Dropdown . Toggle { ...toggleProps } >
17
+ < Dropdown { ...dropdownProps }
18
+ bsSize = { bsSize }
19
+ bsStyle = { bsStyle }
20
+ >
21
+ < Dropdown . Toggle
22
+ { ...toggleProps }
23
+ disabled = { disabled }
24
+ >
16
25
{ title }
17
26
</ Dropdown . Toggle >
18
27
< Dropdown . Menu >
19
- { this . props . children }
28
+ { children }
20
29
</ Dropdown . Menu >
21
30
</ Dropdown >
22
31
) ;
23
32
}
24
33
}
25
34
26
35
DropdownButton . propTypes = {
36
+ disabled : React . PropTypes . bool ,
27
37
bsStyle : Button . propTypes . bsStyle ,
28
38
bsSize : Button . propTypes . bsSize ,
29
39
@@ -37,6 +47,7 @@ DropdownButton.propTypes = {
37
47
} ;
38
48
39
49
DropdownButton . defaultProps = {
50
+ disabled : false ,
40
51
pullRight : false ,
41
52
dropup : false ,
42
53
navItem : false ,
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import React from 'react';
2
2
import Button from './Button' ;
3
3
import Dropdown from './Dropdown' ;
4
4
import SplitToggle from './SplitToggle' ;
5
+ import omit from 'lodash-compat/object/omit' ;
6
+ import pick from 'lodash-compat/object/pick' ;
5
7
6
8
class SplitButton extends React . Component {
7
9
@@ -12,30 +14,32 @@ class SplitButton extends React.Component {
12
14
onClick,
13
15
target,
14
16
href,
17
+ bsSize,
15
18
bsStyle,
16
19
...props } = this . props ;
17
20
18
21
let { disabled } = props ;
19
22
20
- let button = (
21
- < Button
22
- onClick = { onClick }
23
- bsStyle = { bsStyle }
24
- disabled = { disabled }
25
- target = { target }
26
- href = { href }
27
- >
28
- { title }
29
- </ Button >
30
- ) ;
23
+ let dropdownProps = pick ( props , Object . keys ( Dropdown . ControlledComponent . propTypes ) ) ;
24
+ let buttonProps = omit ( props , Object . keys ( Dropdown . ControlledComponent . propTypes ) ) ;
31
25
32
26
return (
33
- < Dropdown { ...props } >
34
- { button }
35
-
27
+ < Dropdown { ...dropdownProps } >
28
+ < Button
29
+ { ...buttonProps }
30
+ onClick = { onClick }
31
+ bsStyle = { bsStyle }
32
+ bsSize = { bsSize }
33
+ disabled = { disabled }
34
+ target = { target }
35
+ href = { href }
36
+ >
37
+ { title }
38
+ </ Button >
36
39
< SplitToggle
37
40
aria-label = { title }
38
41
bsStyle = { bsStyle }
42
+ bsSize = { bsSize }
39
43
disabled = { disabled }
40
44
/>
41
45
< Dropdown . Menu >
You can’t perform that action at this time.
0 commit comments