1
- import React from 'react' ;
2
1
import classnames from 'classnames' ;
2
+ import React from 'react' ;
3
3
import all from 'react-prop-types/lib/all' ;
4
+
4
5
import SafeAnchor from './SafeAnchor' ;
6
+ import createChainedFunction from './utils/createChainedFunction' ;
5
7
6
8
export default class MenuItem extends React . Component {
7
9
constructor ( props ) {
@@ -35,27 +37,25 @@ export default class MenuItem extends React.Component {
35
37
) ;
36
38
}
37
39
40
+ const { className, style, href, onClick, ...props } = this . props ;
41
+
38
42
const classes = {
39
43
disabled : this . props . disabled ,
40
44
active : this . props . active
41
45
} ;
42
46
43
47
return (
44
48
< li role = "presentation"
45
- className = { classnames ( this . props . className , classes ) }
46
- style = { this . props . style }
49
+ className = { classnames ( className , classes ) }
50
+ style = { style }
47
51
>
48
52
< SafeAnchor
53
+ { ...props }
49
54
role = "menuitem"
50
55
tabIndex = "-1"
51
- id = { this . props . id }
52
- target = { this . props . target }
53
- title = { this . props . title }
54
- href = { this . props . href || '' }
55
- onKeyDown = { this . props . onKeyDown }
56
- onClick = { this . handleClick } >
57
- { this . props . children }
58
- </ SafeAnchor >
56
+ href = { href || '' }
57
+ onClick = { createChainedFunction ( onClick , this . handleClick ) }
58
+ />
59
59
</ li >
60
60
) ;
61
61
}
@@ -80,6 +80,7 @@ MenuItem.propTypes = {
80
80
href : React . PropTypes . string ,
81
81
target : React . PropTypes . string ,
82
82
title : React . PropTypes . string ,
83
+ onClick : React . PropTypes . func ,
83
84
onKeyDown : React . PropTypes . func ,
84
85
onSelect : React . PropTypes . func ,
85
86
id : React . PropTypes . oneOfType ( [
0 commit comments