Skip to content

Use material-ui v5 LoadingButton #1658

Description

@goto-bus-stop

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>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions