Improve save button copy in TemplateVariableEditor

pull/10616/head
Christopher Henn 2018-06-19 13:21:27 -07:00
parent 901a034f3a
commit 19e6821e30
1 changed files with 22 additions and 2 deletions

View File

@ -100,7 +100,9 @@ class TemplateVariableEditor extends PureComponent<Props, State> {
return (
<div className="edit-temp-var">
<div className="edit-temp-var--header">
<h1 className="page-header__title">Edit Template Variable</h1>
<h1 className="page-header__title">
{isNew ? 'Create' : 'Edit'} Template Variable
</h1>
<div className="edit-temp-var--header-controls">
<button
className="btn btn-default"
@ -115,7 +117,7 @@ class TemplateVariableEditor extends PureComponent<Props, State> {
onClick={this.handleSave}
disabled={!this.canSave}
>
{this.isSaving ? 'Saving...' : 'Save'}
{this.saveButtonText}
</button>
</div>
</div>
@ -277,6 +279,24 @@ class TemplateVariableEditor extends PureComponent<Props, State> {
)
}
private get saveButtonText(): string {
const {isNew} = this.state
if (this.isSaving && isNew) {
return 'Creating...'
}
if (this.isSaving && !isNew) {
return 'Saving...'
}
if (!this.isSaving && isNew) {
return 'Create'
}
return 'Save'
}
private handleDelete = (): void => {
const {onDelete} = this.props