Skip to content

Conversation

taysea
Copy link
Collaborator

@taysea taysea commented Mar 17, 2023

What does this PR do?

This PR fixes some issues with how badge was calculating its dimensions. Because of the use of useLayoutEffect, instead of handling height/width of badge with useState, we apply the style directly to the DOM.

Additionally, theme.button.badge.align was added. If the value is specified as container then the badge will always offset from the button container.

Snapshot changes are due to the offset/width/height being applied directly to the DOM as opposed to in the CSS styles.

Where should the reviewer start?

src/js/components/Button/Badge.js

What testing has been done on this PR?

Local storybook with HPE next theme, grommet theme

How should this be manually tested?

Do Jest tests follow these best practices?

  • 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?

Screenshots (if appropriate)

Do the grommet docs need to be updated?

Should this PR be mentioned in the release notes?

Yes. Added theme.button.badge.align.

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

Yes.

@taysea taysea requested a review from ericsoderberghp March 17, 2023 17:43
Copy link
Contributor

@ericsoderberghp ericsoderberghp left a comment

Choose a reason for hiding this comment

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

very small suggestions

@taysea taysea requested a review from ericsoderberghp March 17, 2023 21:27
@ericsoderberghp ericsoderberghp merged commit 69482c4 into grommet:master Mar 17, 2023
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.

2 participants