File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ env :
2+ browser : true
3+ es6 : true
4+ extends : ' eslint:recommended'
5+ installedESLint : true
6+ parserOptions :
7+ ecmaFeatures :
8+ experimentalObjectRestSpread : true
9+ jsx : true
10+ sourceType : module
11+ plugins :
12+ - react
13+ rules :
14+ indent :
15+ - error
16+ - 2
17+ linebreak-style :
18+ - error
19+ - unix
20+ quotes :
21+ - error
22+ - single
23+ semi :
24+ - error
25+ - never
Original file line number Diff line number Diff line change 3131 "devDependencies" : {
3232 "babel" : " ^5.8.23" ,
3333 "chai" : " ^3.3.0" ,
34+ "eslint" : " 3.2.2" ,
35+ "eslint-plugin-react" : " 6.0.0" ,
3436 "gulp" : " ^3.8.11" ,
3537 "legit-tests" : " ^0.4.4" ,
3638 "mocha" : " ^2.3.3" ,
Original file line number Diff line number Diff line change @@ -11,11 +11,11 @@ export default class Modal extends React.Component{
1111
1212 let opacity = 0 ,
1313 display = 'block' ,
14- visibility = 'hidden' ;
14+ visibility = 'hidden'
1515
1616 if ( props . show ) {
17- opacity = 1 ;
18- display = 'block' ;
17+ opacity = 1
18+ display = 'block'
1919 visibility = 'visible'
2020 }
2121
@@ -24,13 +24,13 @@ export default class Modal extends React.Component{
2424 display,
2525 visibility,
2626 show : props . show
27- } ;
27+ }
2828
2929 }
3030
3131 hideOnOuterClick ( event ) {
3232 if ( this . props . closeOnOuterClick === false ) return
33- if ( event . target . dataset . modal ) this . props . onClose ( event )
33+ if ( event . target . dataset . modal && this . props . onClose instanceof Function ) this . props . onClose ( event )
3434 }
3535
3636 componentWillReceiveProps ( props ) {
@@ -78,12 +78,27 @@ export default class Modal extends React.Component{
7878 if ( this . props . transitionSpeed ) modalStyle = Object . assign ( { } , this . state , modalStyle )
7979
8080 return (
81- < div { ...this . props } style = { modalStyle } onClick = { this . hideOnOuterClick } data-modal = "true" >
81+ < div { ..._filteredProps ( this . props ) } style = { modalStyle } onClick = { this . hideOnOuterClick } data-modal = "true" >
8282 < div className = { this . props . containerClassName } style = { containerStyle } >
8383 { this . props . children }
8484 </ div >
8585 </ div >
8686 )
8787 }
8888}
89+
90+ function _filteredProps ( props ) {
91+ const filtered = Object . assign ( { } , props ) ;
92+ [
93+ 'containerStyle' ,
94+ 'containerClassName' ,
95+ 'closeOnOuterClick' ,
96+ 'show' ,
97+ 'onClose'
98+ ] . map ( p => {
99+ delete filtered [ p ]
100+ } )
101+ return filtered
102+ }
103+
89104export var closeStyle = styles . close
You can’t perform that action at this time.
0 commit comments