-
Notifications
You must be signed in to change notification settings - Fork 32
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 size
prop to Icon
component
#796
Conversation
🦋 Changeset detectedLatest commit: 2fef888 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
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 |
a93f66e
to
158f186
Compare
🟢 No design token changes found |
|
86044ce
to
4b54fcb
Compare
7dd4bcb
to
4b54fcb
Compare
NextJS seem to be in the process of messing around with their React version (they're currently on a React 19 RC), which is the underlying cause of the pipeline failure. If you're happy to just ignore the failing check for now @rezrah then we can come back to it once it's settled down. |
packages/react/src/Icon/Icon.tsx
Outdated
export const namedIconSizes = ['small', 'medium', 'large'] as const | ||
export type NamedIconSize = (typeof namedIconSizes)[number] | ||
|
||
export const numericIconSizes = [12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52] as const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we max out at 44
please per this guidance
export const numericIconSizes = [12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52] as const | |
export const numericIconSizes = [20, 24, 28, 32, 36, 40, 44] as const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to do that if @danielguillan is happy.
These numbers have come from Dani's FIgma designs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah cool, that's good to know. We'll need to follow up In Figma after too, as the Site guidance supersedes that. Particularly in the React version, we'd want to provide the correct guardrails so recommend we go ahead with the 20-44 range.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to limit the scale and expand it later if needed. I just want to check with @simmonsjenna to confirm that we've considered scenarios beyond Bento, Card, and Pillar in making this decision. For example, I'm thinking about icons that align with the default body text (16px) in Primer Brand components like Button, Label, and UnorderedList, among others. I'm not suggesting we necessarily use Icon in those, but those are potential use cases. Also custom elements might benefit from the expanded scale as there are several places in dotcom where use icons smaller than 20 and larger than 44.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danielguillan Great point — I need to do a more in-depth audit of icon usage across those scenarios you mentioned. I think we can expand it later to include those smaller icon instances as well.
Are there any examples where an icon larger than 44 is live?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good!
I believe there's only one icon larger than 44 in landing pages but there are some more on product pages that could potentially use Primer Brand components at some point (e.g., upsell). That said, we don't need to support those larger sizes if we want to discourage that. Octicons aren't actually designed for larger sizes either way. We can create some guardrails around that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Visual snapshots will need an update, but otherwise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! I left one comment about the numeric size scale, but it's non-blocking.
Summary
Adds
size
prop toIcon
component following @simmonsjenna's suggested sizing, and @danielguillan's Figma designs.List of notable changes:
size
propWhat should reviewers focus on?
!important
in the CSS. If you're not happy with that then I'm happy to tweak the approach to use specificity to override the background styles instead.Steps to test:
Supporting resources (related issues, external links, etc):
Bento.Item
to appear the same asCard
(with a background) #773Contributor checklist:
Reviewer checklist:
Screenshots: