u-wave/web

Use material-ui v5 LoadingButton

Opened this issue · 1 comments

For after #1287

We have a couple of places where we manually stick a CircularProgress in a Button when we're waiting for an HTTP request to finish. material-ui v5 has a LoadingButton component, which takes a pending prop for this purpose. It looks a bit better and it can also keep showing the button text while the operation is in progress.

These are the ones I found:

<Button disabled={busy} onClick={this.handleConfirm}>
{busy ? <div className="Button-loading"><CircularProgress size="100%" /></div> : confirmLabel}
</Button>

<Button
className="LoginForm-submit"
disabled={busy}
>
{busy ? (
<div className="Button-loading">
<CircularProgress size="100%" />
</div>
) : t('login.login')}
</Button>

<Button
className="RegisterForm-submit"
disabled={isBusy || !agreed}
>
{isBusy
? <div className="Button-loading"><CircularProgress size="100%" /></div>
: t('login.register')}
</Button>

<Button disabled={busy}>
{busy ? <div className="Button-loading"><CircularProgress size="100%" /></div> : submitLabel}
</Button>

<Button
className="RegisterForm-submit"
disabled={busy || !agreed || !captchaOk}
>
{busy
? <div className="Button-loading"><CircularProgress size="100%" /></div>
: t('login.register')}
</Button>

If no one has taken up this issue, I would like to pick it up