2
2
import React from 'react' ;
3
3
import types from 'prop-types' ;
4
4
import { PrimaryButton } from '../buttons' ;
5
+ import { Icon } from '../iconography' ;
5
6
import classnames from 'classnames' ;
6
7
7
8
function doNothing ( ) {
@@ -13,14 +14,18 @@ export class Wizard extends React.Component {
13
14
cancel : types . func ,
14
15
cancelText : types . string ,
15
16
finish : types . func ,
16
- finishText : types . string
17
+ finishText : types . string ,
18
+ saving : types . bool ,
19
+ savingText : types . string
17
20
} ;
18
21
19
22
static defaultProps = {
20
23
pages : [ ] ,
21
24
cancelText : 'Cancel' ,
22
25
finish : doNothing ,
23
- finishText : 'Finish'
26
+ finishText : 'Finish' ,
27
+ saving : false ,
28
+ savingText : 'Saving'
24
29
} ;
25
30
26
31
constructor ( props ) {
@@ -74,7 +79,7 @@ export class Wizard extends React.Component {
74
79
}
75
80
76
81
render ( ) {
77
- const { cancel, cancelText, className, pages, finishText, style} = this . props ;
82
+ const { cancel, cancelText, className, pages, finishText, style, saving , savingText } = this . props ;
78
83
const { currentPage} = this . state ;
79
84
80
85
const page = pages [ currentPage ] ;
@@ -94,13 +99,17 @@ export class Wizard extends React.Component {
94
99
) ;
95
100
96
101
const backButton = (
97
- < PrimaryButton alt className = "wizard-back-btn"
102
+ < PrimaryButton alt className = "wizard-back-btn" disabled = { saving }
98
103
onClick = { this . onClickBack } > Back</ PrimaryButton >
99
104
) ;
100
105
106
+ const icon = saving && < Icon src = "spinner-sm" /> ;
101
107
const finishButton = (
102
- < PrimaryButton className = "wizard-finish-btn"
103
- onClick = { this . onClickFinish } > { finishText } </ PrimaryButton >
108
+ < PrimaryButton { ...{
109
+ className : "wizard-finish-btn" ,
110
+ icon,
111
+ onClick : this . onClickFinish
112
+ } } > { saving ? savingText : finishText } </ PrimaryButton >
104
113
) ;
105
114
106
115
const nextButton = (
0 commit comments