File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,10 @@ import PropTypes from 'lib/PropTypes';
10
10
import React from 'react' ;
11
11
import styles from 'components/Button/Button.scss' ;
12
12
13
+ const noop = ( ) => { } ;
14
+
13
15
let Button = ( props ) => {
16
+ const hasOnClick = props . onClick && ! props . disabled ;
14
17
let classes = [ styles . button , unselectable ] ;
15
18
// if a button is disabled, that overrides any color selection
16
19
if ( props . disabled ) {
@@ -30,9 +33,7 @@ let Button = (props) => {
30
33
classes . push ( styles . progress ) ;
31
34
}
32
35
}
33
- let clickHandler = ( props . onClick && ! props . disabled ) ?
34
- props . onClick :
35
- function ( ) { } ;
36
+ let clickHandler = hasOnClick ? props . onClick : noop ;
36
37
let styleOverride = null ;
37
38
if ( props . width ) {
38
39
styleOverride = { width : props . width , minWidth : props . width , ...props . additionalStyles } ;
You can’t perform that action at this time.
0 commit comments