Skip to content

Added button busy animation #6656

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

Merged
merged 15 commits into from
Mar 28, 2023
Merged

Conversation

jcfilben
Copy link
Collaborator

@jcfilben jcfilben commented Feb 28, 2023

What does this PR do?

Adds a busy prop to button to support an animation while button is loading or waiting for something. The animation also indicates when the button action succeeds.

Where should the reviewer start?

What testing has been done on this PR?

Added a story

How should this be manually tested?

Do Jest tests follow these best practices?

Planning to go back in and add a jest test

  • screen is used for querying.
  • The correct query is used. (Refer to this list of queries)
  • userEvent is used in place of fireEvent.
  • asFragment() is used for snapshot testing.

Any background context you want to provide?

What are the relevant issues?

grommet/hpe-design-system#3090
closes grommet/hpe-design-system#3174

Screenshots (if appropriate)

Do the grommet docs need to be updated?

Yes

Should this PR be mentioned in the release notes?

Yes

Is this change backwards compatible or is it a breaking change?

backwards compatible

@jcfilben jcfilben marked this pull request as draft February 28, 2023 21:11
<Button
primary
busy={{
state: busy,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make more sense for busy to be a boolean. Then the "success" state would automatically rendered for "X" amount of time when busy changes from true to false?

Copy link
Collaborator

@taysea taysea Mar 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pausing now to think about what happens if a button is busy, then the process fails..

so maybe scratch that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on our discussion yesterday evening I changed busy to be a boolean. I changed messages to no longer be nested within busy and instead just a prop on Button. I also added a success prop that is a boolean.

100% { transform: scale(1); }
`;

export const GrowCheckmark = styled(FormCheckmark)`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've been talking about leaning away from use of "Form" icons --> wondering if we should use the normal "Checkmark" here. @ericsoderberghp

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried using the regular 'Checkmark' icon but the sizing looks off. Here is the default size:
Screen Shot 2023-03-03 at 9 38 22 AM

And here is the small size:
Screen Shot 2023-03-03 at 9 45 06 AM

This is what is looks like with FormCheckmark:
Screen Shot 2023-03-03 at 9 46 26 AM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should ensure it looks reasonable with the grommet theme as well.

For the HPE theme, this will be resolved with the icon sizing work Taylor is doing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are the different options in the grommet theme:

Checkmark medium size:
Screen Shot 2023-03-06 at 12 36 23 PM

Checkmark small size:
Screen Shot 2023-03-06 at 12 38 10 PM

FormCheckmark:
Screen Shot 2023-03-06 at 12 35 25 PM

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested with the grommet-theme-hpe next-stable and grommet-icons stable. Here is the Checkmark icon with the default size:

Screen Shot 2023-03-08 at 4 30 19 PM

Screen Shot 2023-03-08 at 4 30 12 PM

This feels reasonable to me

@taysea taysea self-requested a review March 28, 2023 20:00
Copy link
Collaborator

@taysea taysea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Button - busy animation implementation
3 participants