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

Button: Do not add [data-size="medium"]` when size is explicitly specified as medium #2929

Merged
merged 3 commits into from
Feb 23, 2023

Conversation

broccolinisoup
Copy link
Member

@broccolinisoup broccolinisoup commented Feb 23, 2023

Describe your changes here.

Closes #2927

Context

The issue is when size="medium" prop is passed to Button, the styles provided via sx prop don't apply. With the way we apply Button styles that were provided via sx is described here.

Issue and solution

The reason that wasn't working for the size="medium" is because the function is adding [data-size="medium"] but we don't have any styles defined with that data-attribute (Because the default size of Button is medium therefore it is styled on the base class) so it was simply disregarding everything. Simply checking if the size is not equal to mediumsolves the issue.

Screenshots

No visual changes

Merge checklist

  • Added/updated documentation
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@broccolinisoup broccolinisoup requested review from a team and joshblack February 23, 2023 02:25
@changeset-bot
Copy link

changeset-bot bot commented Feb 23, 2023

🦋 Changeset detected

Latest commit: 0144037

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
Copy link
Contributor

github-actions bot commented Feb 23, 2023

size-limit report 📦

Path Size
dist/browser.esm.js 94.58 KB (+0.01% 🔺)
dist/browser.umd.js 95.16 KB (+0.01% 🔺)

Copy link
Contributor

@langermank langermank left a comment

Choose a reason for hiding this comment

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

Thank you for this! 🚀

@broccolinisoup broccolinisoup added this pull request to the merge queue Feb 23, 2023
Merged via the queue into main with commit ee4b76f Feb 23, 2023
@broccolinisoup broccolinisoup deleted the button-medium-sx-override branch February 23, 2023 22:36
@primer-css primer-css mentioned this pull request Feb 23, 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.

Button style overrides for size medium break in 35.20
3 participants