-
Notifications
You must be signed in to change notification settings - Fork 33
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
Integrate Icon component into Bento and Card #798
Conversation
🦋 Changeset detectedLatest commit: eb51421 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 |
🔍 Design token changes foundView CSS variable changes- --brand-Icon-color-default: var(--base-color-scale-gray-5);
+ --brand-Icon-color-default: var(--brand-color-text-default); |
🟢 No visual differences foundOur visual comparison tests did not find any differences in the UI. |
9e46d68
to
4846907
Compare
b88cae4
to
ad7504a
Compare
ad7504a
to
b160399
Compare
0b7ffa8
to
80183da
Compare
@@ -83,7 +83,7 @@ You can add an `icon` to enhance the visual context. We recommend using an [Octi | |||
|
|||
```jsx live | |||
<Card href="https://github.com"> | |||
<Card.Icon icon={<CopilotIcon />} color="purple" hasBackground /> | |||
<Card.Icon icon={CopilotIcon} color="purple" hasBackground /> |
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.
Does Icon still support passing the instantiated component, or only reference? I.e. if user wanted to customize values here, can they still do it?
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.
No, that was removed by design after speaking with @danielguillan to avoid situations like this:
<Card.Icon icon={<CopilotIcon size={20} />} size={44} />
Since Card.Icon
forwards all of its props to the provided icon, you could easily end up in these awkward situations where two props clash.
Do you think this should be called out as a breaking change in the changeset?
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.
Thanks for this example. Makes sense 👍
This is a breaking change if we don't allow instantiated JSX anymore, yeah. Unless there's a really important reason for it, we should continue to support both ways, as we have many instances in dotcom and elsewhere that use that approach and we can more easily work around it on our side than the users. In many of those instances, the user doesn't apply size too, so this is less of a risk IMO.
E.g.
Suggestion:
Update our docs and examples to show the reference approach (happy path), and ensure that instantiated JSX can continue to be passed for continuity. How does that sound?
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.
Update for posterity.. I've pushed the changes ☝️ in this commit
- passing JSX is now working
- removed breaking change notice
- added a new story to track future regressions
packages/design-tokens/src/tokens/functional/components/card/colors.json
Show resolved
Hide resolved
...t/src/Bento/Bento.visual.spec.ts-snapshots/Visual-Comparison-Bento-Bento-Default-1-linux.png
Outdated
Show resolved
Hide resolved
@@ -120,20 +121,21 @@ export const IconColors: StoryFn<typeof Card> = () => { | |||
export const WithIconSVG = () => ( | |||
<Card href="https://github.com"> | |||
<Card.Icon | |||
icon={ | |||
icon={props => ( |
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.
Is props
doing something specific here or can we keep it the same as the other stories / the same as before?
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.
props
includes the classNames, without it the Icon styles won't be applied to the svg
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 guessing this was needed because we only accepted function references? What would happen if someone forgot to spread the props?
For now, I've rolled this back to allow passing the SVG directly as a prop. We can figure out if the props argument is still needed when you're back.
6af5216
to
0277f8a
Compare
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.
Looking great! It just needs the adjustment to the default icon color we discussed in Slack.
Summary
Replace custom Icon implementations in
Bento
andCard
components with newIcon
component.List of notable changes:
Bento
andCard
components with newIcon
component.Bento
component where the icon's default colour would be black, rather than the gray as it should have been. See here for the previous issue (variable should usebase
instead ofbrand
).What should reviewers focus on?
Card
component is an intentional change to align with the FigmaCard
.Supporting resources (related issues, external links, etc):
Bento.Item
to appear the same asCard
(with a background) #773Contributor checklist:
Reviewer checklist:
Screenshots: