11import React from 'react' ;
22import cn from 'classnames' ;
33
4+ import Dialog from './Dialog' ;
5+
46import './rodal.css' ;
57
68// env
@@ -9,35 +11,6 @@ const UA = IN_BROWSER && window.navigator.userAgent.toLowerCase();
911const IS_IE_9 = UA && UA . indexOf ( 'msie 9.0' ) > 0 ;
1012
1113
12- const Dialog = ( props : DialogProps ) => {
13- const animation =
14- ( props . animationType === 'enter'
15- ? props . enterAnimation
16- : props . leaveAnimation ) || props . animation ;
17-
18- const className = `rodal-dialog rodal-${ animation } -${ props . animationType } ` ;
19-
20- const { width, height, measure, duration } = props ;
21-
22- const style = {
23- width : width + measure ,
24- height : height + measure ,
25- animationDuration : duration + 'ms' ,
26- WebkitAnimationDuration : duration + 'ms'
27- } ;
28-
29- const mergedStyles = { ...style } ;
30-
31- return (
32- < div style = { mergedStyles }
33- className = { className }
34- >
35- { props . children }
36- </ div >
37- ) ;
38- } ;
39-
40-
4114class Rodal extends React . Component < Props , State > {
4215 el : HTMLDivElement | null = null ;
4316
@@ -126,7 +99,6 @@ class Rodal extends React.Component<Props, State> {
12699 duration,
127100 className,
128101 children,
129- customStyles,
130102 showCloseButton,
131103 popupClass
132104 } = this . props ;
@@ -154,7 +126,7 @@ class Rodal extends React.Component<Props, State> {
154126 return (
155127 < div
156128 style = { style }
157- className = { cn ( 'rodal' , `rodal-fade-${ animationType } ` , className ) }
129+ className = { cn ( 'rodal' , `rodal-fade-${ animationType } ` , className , 'rodal-background' ) }
158130 onAnimationEnd = { this . animationEnd }
159131 tabIndex = { - 1 }
160132 ref = {
@@ -168,9 +140,7 @@ class Rodal extends React.Component<Props, State> {
168140 < Dialog { ...this . props }
169141 animationType = { animationType }
170142 >
171- < div className = { `child-wrapper ${ popupClass } ` }
172- style = { { ...customStyles } }
173- >
143+ < div className = { `child-wrapper ${ popupClass } ` } >
174144 { children }
175145 { CloseButton }
176146 </ div >
@@ -184,46 +154,32 @@ class Rodal extends React.Component<Props, State> {
184154Rodal . defaultProps = {
185155 width : 400 ,
186156 height : 240 ,
187- measure : 'px' ,
188157 visible : false ,
189158 showMask : true ,
190159 closeOnEsc : false ,
191160 closeMaskOnClick : true ,
192161 showCloseButton : true ,
193- animation : 'zoom' ,
194- enterAnimation : '' ,
195- leaveAnimation : '' ,
196- onAnimationEnd : ( ) => { } ,
162+ animation : 'zoom' , // slideup for msite;
197163 duration : 300 ,
198164 className : '' ,
199165 customStyles : { } ,
200- customMaskStyles : { }
166+ customMaskStyles : { } ,
167+ popupClass : 'popup-border' ,
168+ enterAnimation : '' ,
169+ leaveAnimation : '' ,
170+ onAnimationEnd : ( ) => { }
201171} as DefaultProps ;
202172
203173
204- type DialogProps = {
205- animation : string ;
206- animationType : string ;
207- enterAnimation : string ;
208- leaveAnimation : string ;
209- width : number ;
210- height : number ;
211- measure : string ;
212- duration : number ;
213- children : React . ReactNode ;
214- }
215-
216-
217174type State = {
218175 isShow : boolean ;
219176 animationType : string ;
220177}
221178
222179
223180type DefaultProps = {
224- width : number ;
225- height : number ;
226- measure : string ;
181+ width : number | string ;
182+ height : number | string ;
227183 visible : boolean ;
228184 showMask : boolean ;
229185 closeOnEsc : boolean ;
0 commit comments