@@ -37,6 +37,7 @@ export default function Stepper({
37
37
const [ plus , setPlus ] = useState ( false ) ;
38
38
const [ Input , setInput ] = useState ( false ) ;
39
39
const animationDiv = document . getElementById ( 'loading' ) ;
40
+ const animationBackground = document . getElementById ( 'loading-background' ) ;
40
41
41
42
const plusBtProps = {
42
43
className : classnames ( baseClass , [ { disabled } , { theme } ] ) ,
@@ -54,13 +55,16 @@ export default function Stepper({
54
55
const handleIncrement = ( ) => {
55
56
if ( loading ) {
56
57
ReactDOM . findDOMNode ( animationDiv ) . style . opacity = 1 ;
58
+ ReactDOM . findDOMNode ( animationBackground ) . style . opacity = 1 ;
57
59
const handlePlus = ( ) => {
58
60
if ( step ) {
59
61
setValue ( value + step ) ;
60
62
ReactDOM . findDOMNode ( animationDiv ) . style . opacity = 0 ;
63
+ ReactDOM . findDOMNode ( animationBackground ) . style . opacity = 0 ;
61
64
} else {
62
65
setValue ( value + 1 ) ;
63
66
ReactDOM . findDOMNode ( animationDiv ) . style . opacity = 0 ;
67
+ ReactDOM . findDOMNode ( animationBackground ) . style . opacity = 0 ;
64
68
}
65
69
} ;
66
70
@@ -75,13 +79,17 @@ export default function Stepper({
75
79
const canMinus = value - step ;
76
80
if ( loading ) {
77
81
ReactDOM . findDOMNode ( animationDiv ) . style . opacity = 1 ;
82
+ ReactDOM . findDOMNode ( animationBackground ) . style . opacity = 1 ;
83
+
78
84
const handleMinus = ( ) => {
79
85
if ( step ) {
80
86
setValue ( value - step ) ;
81
87
ReactDOM . findDOMNode ( animationDiv ) . style . opacity = 0 ;
88
+ ReactDOM . findDOMNode ( animationBackground ) . style . opacity = 0 ;
82
89
} else {
83
90
setValue ( value - 1 ) ;
84
91
ReactDOM . findDOMNode ( animationDiv ) . style . opacity = 0 ;
92
+ ReactDOM . findDOMNode ( animationBackground ) . style . opacity = 0 ;
85
93
}
86
94
} ;
87
95
setTimeout ( handleMinus , 2000 ) ;
@@ -197,7 +205,11 @@ export default function Stepper({
197
205
< button onClick = { handleIncrement } { ...plusBtProps } disabled = { plus } >
198
206
+
199
207
</ button >
200
- { loading && < div id = 'loading' className = 'loading' /> }
208
+ { loading && (
209
+ < div id = 'loading-background' className = 'load' >
210
+ < div id = 'loading' className = 'load-background' />
211
+ </ div >
212
+ ) }
201
213
</ div >
202
214
) ;
203
215
}
0 commit comments