Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@busy attribute on <Button/> #68

Open
knownasilya opened this issue May 6, 2020 · 2 comments
Open

@busy attribute on <Button/> #68

knownasilya opened this issue May 6, 2020 · 2 comments
Labels
Type: Enhancement New feature or request

Comments

@knownasilya
Copy link
Contributor

knownasilya commented May 6, 2020

<Button @busy={{true}}> would show a loading spinner. Also a good time to add a spinner component too.

Atm a spinner is a pain to add to tailwind, so this would be sweet.

@josemarluedke josemarluedke added the Type: Enhancement New feature or request label May 6, 2020
@josemarluedke
Copy link
Owner

josemarluedke commented May 6, 2020

This totally makes sense. I was planning to get a loading state for button as isLoading

<Button @isLoading={{true}}>Save</Button>

There is another approach I want to explore, something like a StatefulButton or AsyncButton that yields a few components, but I need to explore if it really makes sense or if there is a better approach.

<StatefulButton
  @isLoading={{this.isLoading}}
  {{on "click" this.save}}
  as |state|
>
  <state.Idle>Submit</state.Idle>
  <state.Loading>Submitting...</state.Loading>
  <state.Done>Success!</state.Done>
</StatefulButton>

@knownasilya
Copy link
Contributor Author

That would be sweet as well. A simple button and a stateful one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants