Skip to content

bugfix(Spinner): Spinner component size get's large when passing sx and size props #5236

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 5 commits into from
Nov 6, 2024

Conversation

jonrohan
Copy link
Member

@jonrohan jonrohan commented Nov 5, 2024

Closes https://github.com/github/primer/issues/4391

This fixes an issue with the Spinner and CSS modules we discovered this morning. The problem is when sx= and size= is passed to the Spinner component, we render <Box as={Spinner} {...props} /> but Box accepts a size= prop as well as Spinner so Box ends up creating some styles thinking that it's meant to render at different breakpoints.

To fix I figured we need to not pass size to Box. So to fix it, I ended up removing Box and using a styled.div component with nothing but ${sx} inside to render any sx props passed along.

This fixed the issue. We created a dev story to recreate the issue.

Changelog

New

Changed

Spinner component size get's large when passing sx and size props

Removed

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

Copy link

changeset-bot bot commented Nov 5, 2024

🦋 Changeset detected

Latest commit: 293ca50

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the staff Author is a staff member label Nov 5, 2024
Copy link
Contributor

github-actions bot commented Nov 5, 2024

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Nov 5, 2024
@github-actions github-actions bot temporarily deployed to storybook-preview-5236 November 5, 2024 20:17 Inactive
Copy link
Contributor

github-actions bot commented Nov 5, 2024

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 98.5 KB (-0.01% 🔽)
packages/react/dist/browser.umd.js 98.88 KB (-0.03% 🔽)

@github-actions github-actions bot temporarily deployed to storybook-preview-5236 November 5, 2024 21:19 Inactive
@jonrohan jonrohan changed the title Bug fix styled spinner bugfix(Spinner): Spinner component size get's large when passing sx and size props Nov 5, 2024
@jonrohan jonrohan marked this pull request as ready for review November 5, 2024 21:24
@jonrohan jonrohan requested a review from a team as a code owner November 5, 2024 21:24
@github-actions github-actions bot temporarily deployed to storybook-preview-5236 November 5, 2024 21:26 Inactive
@primer-integration
Copy link

👋 Hi from github/github! Your integration PR is ready: https://github.com/github/github/pull/350104

jonrohan and others added 2 commits November 5, 2024 13:30
Co-authored-by: Josh Black <joshblack@github.com>
Co-authored-by: Josh Black <joshblack@github.com>
}

return <Spinner className={classes.SpinnerAnimation} {...props} />
return <Spinner className={clsx(className, classes.SpinnerAnimation)} {...props} />
Copy link
Member Author

Choose a reason for hiding this comment

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

Not related to the bug, but was pointed out that className was overwriting the CSS modules classname when being passed in, so I added this

@primer-integration
Copy link

🟢 golden-jobs completed with status success.

@jonrohan jonrohan requested a review from joshblack November 5, 2024 22:04
@jonrohan jonrohan added this pull request to the merge queue Nov 6, 2024
Merged via the queue into main with commit 2e5c601 Nov 6, 2024
43 checks passed
@jonrohan jonrohan deleted the spinner_box_fix branch November 6, 2024 19:47
@primer primer bot mentioned this pull request Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm staff Author is a staff member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants