-
Notifications
You must be signed in to change notification settings - Fork 293
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
Create Button with Spinner component #5271
Comments
Should the ACs here require a new component? This strikes me as the sort of thing that would be good to add as a prop to the existing Button component. |
Hey @tofumatt, this is a good question and something I was pondering when writing the design doc. In the end I went with a separate component as I figure this is currently a one-off use case and it's nice to not overcomplicate the existing In the design doc, which has obviously been signed off, I have described the new Button with Spinner component as follows:
So, I would be inclined to keep the AC on this basis. Or maybe something like this -
What do you think? |
I think that last phrasing is probably fine. My preference is to integrate it into the existing |
@techanvil do we really need to control the spinner via a property? I have added IB that explains how we can do it internally within the new component. Does it sound good to you? |
Hi @eugene-manuilov, that sounds fine to me and it would be compatible with the specced out usage of it in #5277, so I am happy to give this IB a I guess if we do find a need for a more declarative API then we can always add a IB ✅ |
QA Update ✅
|
Feature Description
Implement the Button with Spinner component.
The Button with Spinner component will look like a regular button, but with an activity spinner embedded within it.
Acceptance criteria
loading
prop that rendered the spinner would be a nice, reusable API. But this should only be done if straightforward in practice.Implementation Brief
SpinnerButton
component in theassets/js/components
folder. This component should the following:Spinner
component in thetrailingIcon
property.Button
element.processing
withfalse
as the default value.onClick
that sets theprocessing
state totrue
, calls theonClick
function passed via props, and resets theprocessing
value back tofalse
after the passedonClick
callback is executed.async/await
approach to call the passedonClick
callback to make sure that we reset theprocessing
state only when the callback has finished working.processing
variable toisSaving
property of theSpinner
element.Test Coverage
QA Brief
Changelog entry
The text was updated successfully, but these errors were encountered: