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
FCT-808: Create CustomIcon
component
#2803
Conversation
🦋 Changeset detectedLatest commit: b31a7a0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 96 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 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
packages/components/icons/src/custom-icon/custom-icon.styles.ts
Outdated
Show resolved
Hide resolved
packages/components/icons/src/custom-icon/custom-icon.styles.ts
Outdated
Show resolved
Hide resolved
width={35} | ||
height={35} |
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 think it would be better for this icon to not have size attributes.
I believe the intention is that the size of the svg
is controlled by the icon size so it grows or shrinks with 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.
This is meant to be an example of a non-standard "custom" svg that a consumer of the library would pass to this component.
To me "custom" means that we do not override the properties that the user specified. If the user wanted the svg to scale, all they would have to do is remove the width
and height
from 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 can remove the width/height here if you'd prefer that for the docs examples though
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 sharing your reasoning, Byron 👍
The way I see it, the main point of this component is to make sure the icons size is consistent across applications, not matter if they are from ui-kit
or custom. I actually think we should update the description of the component to better explain about this.
If users provide a custom icon with a specific size, we won't get the expected behaviour because, as in the current state with the fixture svg, making the CustomIcon
component bigger does not make the svg bigger, which I think that's what we want.
So yes, I would suggest to remove the size properties of the fixture SVG and also to update the description of the component (we can ask Filip for help).
20b3e4d
to
67c723c
Compare
@ByronDWall thanks for tackling this! I found one issue with the border. If the border is turned on, the underlaying svg seems to cut through the border-radius. |
@FilPob thanks for pointing that out, the issue should be fixed now |
@ByronDWall thanks, border looks good now. One more thing I noticed is that sometimes the custom svg doesn't scale if you change the size. It could be that this is just a storybook issue cause if you toggle the |
…py sizing values into style file directly, remove warning
…get clipped by border radius
d9d7fca
to
40a4b86
Compare
@FilPob I believe this is an issue with storybook, the stringified svg is using the |
@ByronDWall I think Filip is not talking about an inline svg issue but an icon one. If you use the icon and change its size, we can see we still have some extra space between the icon and the border, but this works if you change from icon to inline svg and back to icon (to be honest, I don't know why). I believe the solution is to change the flex styles from the wrapping div and just use a |
…uting svg width as 0px in flex containers where there is no w/h specified for the svg
This was an interesting issue, because I could not reproduce it in firefox. Was able to in chrome. Fixed |
packages/components/icons/src/leading-icon/leading-icon.styles.ts
Outdated
Show resolved
Hide resolved
@FilPob I think UI wise this is ready. Could you please take another look when you have the time? 🙏 |
Looks perfect now! thanks @CarlosCortizasCT @ByronDWall :) |
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 your contribution, Byron 👍
Summary
Based on our discussion about how
LeadingIcon
handles non-ui-kit icons in this issue, this PR introduces a newCustomIcon
component that handles displaying non-ui-kit SVG's in a consistent manner.Description
The
CustomIcon
is similar to theLeadingIcon
, but is intended to display non-ui-kit icons. See the linked issue for more details.