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

Add min-width to small size Button #2821

Merged
merged 8 commits into from
Apr 30, 2024
Merged

Conversation

khiga8
Copy link
Contributor

@khiga8 khiga8 commented Apr 30, 2024

Authors: Please fill out this form carefully and completely.

Reviewers: By approving this Pull Request you are approving the code change, as well as its deployment and mitigation plans.
Please read this description carefully. If you feel there is anything unclear or missing, please ask for updates.

What are you trying to accomplish?

This PR adds guardrails to ensure a min-width of 24px for small variant of button. When inputting one character, such as I, the width of the button will be 21px which makes it fail the target size requirement.

Before:
Screenshot of small button size, with content `i`, and width of 21px

After:

Screenshot of small button size, with content `i`, and width of 24px

Integration

I don't believe so.

List the issues that this change affects.

Fixes: https://github.com/github/primer/issues/3073

Risk Assessment

  • Low risk the change is small, highly observable, and easily rolled back.
  • Medium risk changes that are isolated, reduced in scope or could impact few users. The change will not impact library availability.
  • High risk changes are those that could impact customers and SLOs, low or no test coverage, low observability, or slow to rollback.

Anything you want to highlight for special attention from reviewers?

Are there any concerns with the min-width overrididing the min-width: max-content set on the base style?
I only targetted the small variant to keep the changes scoped.

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Lookbook)
  • 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.

Copy link

changeset-bot bot commented Apr 30, 2024

🦋 Changeset detected

Latest commit: 627b1f1

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

This PR includes changesets to release 1 package
Name Type
@primer/view-components 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

@khiga8 khiga8 changed the title Add min-width Add min-width to small size Button Apr 30, 2024
Copy link
Contributor

github-actions bot commented Apr 30, 2024

⚠️ Visual differences found

Our visual comparison tests found UI differences. Please review the differences by viewing the files changed tab to ensure that the changes were intentional.

Review visual differences

@khiga8 khiga8 marked this pull request as ready for review April 30, 2024 16:32
@khiga8 khiga8 requested review from a team as code owners April 30, 2024 16:32
@khiga8 khiga8 requested review from lukasoppermann, TylerJDev and lindseywild and removed request for a team April 30, 2024 16:32
@@ -128,6 +128,7 @@ summary.Button {
height: var(--control-small-size);
padding: 0 var(--control-small-paddingInline-condensed);
gap: var(--control-small-gap);
min-width: 24px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
min-width: 24px;
min-width: var(--control-small-size);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah thank you! Sorry if this is a silly q- where are these defined?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not silly! You can find it in our docs: https://primer.style/foundations/primitives/size#controls. For this kind of change in particular, I would just look at what other sizing variables are used in the rest of the component CSS and try and align with that 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TIL! Thank you! ⭐

khiga8 and others added 2 commits April 30, 2024 13:23
Co-authored-by: Katie Langerman <18661030+langermank@users.noreply.github.com>
@khiga8 khiga8 force-pushed the kh-set-min-width-for-button branch from 0f1142c to 627b1f1 Compare April 30, 2024 17:50
@khiga8
Copy link
Contributor Author

khiga8 commented Apr 30, 2024

I am not authorized to merge so feel free to merge this whenever :)

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

Successfully merging this pull request may close these issues.

3 participants