-
Notifications
You must be signed in to change notification settings - Fork 72
[LG-5766] fix: Icon fill support #3377
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: b7843ad The changes in this PR will be included in the next version bump. This PR includes changesets to release 74 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 |
|
Size Change: +134 B (+0.01%) Total Size: 1.81 MB
ℹ️ View Unchanged
|
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.
Pull request overview
This PR fixes icon fill support by explicitly passing the fill prop through the createIconComponent function to the underlying SVG components. The change ensures that the fill prop (which is converted to a CSS color property by the generated icon components) is properly threaded through the icon wrapper.
Key changes:
- Modified
createIconComponentto explicitly destructure and pass thefillprop to SVG components - Added test coverage to verify that the
fillprop correctly applies CSS color styling
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/icon/src/createIconComponent.tsx | Explicitly destructures fill from props and passes it to the SVG component |
| packages/icon/src/Icon.spec.tsx | Adds test to verify fill prop applies CSS color correctly |
|
Coverage after merging ar/LG-5766-icon-fix into main will be
Coverage Report for Changed Files
|
|||||||||||||||||||||||||
✍️ Proposed changes
Fixes a bug where the
fillprop was not being passed to the underlying SVG component when using icons created throughcreateIconComponent. Previously, thefillprop was being absorbed by the spread operator but not explicitly passed to theSVGComponent, causing the fill color to not apply correctly.🎟️ Jira ticket: LG-5766
✅ Checklist
pnpm changesetand documented my changes🧪 How to test changes
Iconcomponent and render it with afillprop:<Icon glyph="Edit" fill="red" />pnpm test --filter=@leafygreen-ui/iconto confirm the fixIcon->Customstory in Storybook