feat: update Icon to be ts and remove all stuff - #4136
Conversation
|
Thanks for the pull request, @holaontiveros! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
❌ Deploy Preview for paragon-openedx-v23 failed. Why did it fail? →Built without sensitive environment variables
|
- Converted from JSX to TSX with native TypeScript types - Removed PropTypes in favor of TypeScript interfaces - Replaced defaultProps with default parameter values - Added proper TypeScript interfaces for IconProps and SvgAttrs - Removed obsolete index.d.ts file - Fixed TypeScript compilation errors Co-authored-by: Claude Sonnet 4 <claude@anthropic.com>
250ce89 to
2c45014
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-23.x #4136 +/- ##
================================================
- Coverage 94.39% 94.21% -0.18%
================================================
Files 242 242
Lines 4296 4305 +9
Branches 1020 994 -26
================================================
+ Hits 4055 4056 +1
- Misses 237 245 +8
Partials 4 4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Hi @brian-smith-tcril - can you take a look for us? |
bradenmacdonald
left a comment
There was a problem hiding this comment.
Sorry for the delay here @holaontiveros! Can you please get the tests passing and take a look at these two notes? Basically I don't want to change the runtime behavior of className in a TypeScript PR.
Then this looks good to go.
| * the `id` property of the Icon element, by default this value is generated | ||
| * with the `newId` function with the `prefix` of `Icon`. | ||
| */ | ||
| id?: string | null; |
There was a problem hiding this comment.
Where did null come from? It seems like id just accepted string | undefined before, so can we leave it at that?
| /** The size of the icon. */ | ||
| size?: 'xs' | 'sm' | 'md' | 'lg' | 'inline'; | ||
| /** A class name that will define what the Icon looks like. */ | ||
| className?: string | string[]; |
There was a problem hiding this comment.
I think our Paragon components generally just accept className?: string, so I don't think we should be adding new string[] functionality here (nor the corresponding Array.isArray(className) ? className.join(' ') : code below).
Fine to do that in a separate PR if you'd like, but I think it's better for className to behave consistently across all Paragon components.
|
Hi @holaontiveros! Friendly ping on this. |
|
@holaontiveros Are you planning to finish up this PR? It's the last thing blocking me from marking #3744 as complete, so I'd like to get it done one way or another. Thanks :) |
|
@jacobo-dominguez-wgu Any chance you could check with @holaontiveros and help us get this PR over the line? I'd like to close out #3744 and this is the last thing blocking it. |
Let me work on in, I'll take just some mins I just forgot to follow this one, Jacobo did ping, thanks |
|
Thanks! |
- Revert id type to string (drop the null it never had before)
- Narrow className to string for consistency with other Paragon
components; remove the Array.isArray(...).join(' ') handling
- Update Icon.test.tsx to match the narrowed types (string className,
drop the obsolete null-id test)
The strict ComponentType<SVGAttributes<SVGElement>> broke Alert, which passes icon?: React.ComponentType<IconProps> to <Icon src=...>. Match the IconButton convention (iconAs?: React.ComponentType<any>) so any icon component is accepted while still rejecting non-component values like strings.
|
@bradenmacdonald I think it's ready but Netlify seemed to failed momentarily I can't re-trigger those could you? |
|
@holaontiveros Thanks a lot! I'll take a look soon. I checked, but I can't find any way to trigger the Netlify job again. Perhaps try rebasing / squashing? I'll just note for myself that your changes are 9da500f and 618c4f1 so I can see the changes even if you squash them. |
|
@bradenmacdonald I did a small change just to re-trigger the netlify stuff but still fails, did something change with netlify related configs? |
Description
Addresses #3744
Deploy Preview
Include a direct link to your changes in this PR's deploy preview here (e.g., a specific component page).
Merge Checklist
Post-merge Checklist