Make the Save button show feedback on save.

This commit is contained in:
Bauke 2022-03-18 00:09:09 +01:00
parent f9e9f3aa5d
commit 4660c42868
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
1 changed files with 10 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import {ConfirmButton} from '@holllo/gram'; import {ConfirmButton, FeedbackButton} from '@holllo/gram';
import {html} from 'htm/preact'; import {html} from 'htm/preact';
import {Component} from 'preact'; import {Component} from 'preact';
import browser from 'webextension-polyfill'; import browser from 'webextension-polyfill';
@ -99,7 +99,8 @@ export class PageMain extends Component<Props, State> {
throw error; throw error;
} }
return; // Return false to make the FeedbackButton not show feedback.
return false;
} }
const bangs = this.state.bangs; const bangs = this.state.bangs;
@ -197,7 +198,13 @@ export class PageMain extends Component<Props, State> {
${editorInputs} ${editorInputs}
<div class="button-group"> <div class="button-group">
<button class="button" onClick=${this.saveBang}>Save</button> <${FeedbackButton}
attributes=${{class: 'button'}}
click=${this.saveBang}
feedbackText="Saved"
text="Save"
timeout=${5 * 1000}
/>
<${ConfirmButton} <${ConfirmButton}
class="button destructive" class="button destructive"
click=${this.removeBang} click=${this.removeBang}