feat(icons): add icon set swapping support#8123
Conversation
WalkthroughAdds SCSS rules that hide the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. No actionable comments were generated in the recent review. 🎉 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
For testing, I manually pulled an svg from the react PR with updated class names into the local build. Here's one I was using to showcase/test the classes that can be used in this PR preview: |
|
Preview: https://pf-pr-8123.surge.sh A11y report: https://pf-pr-8123-a11y.surge.sh |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@src/patternfly/base/patternfly-svg-icons.scss`:
- Around line 10-22: The CSS class names use underscores and a non-PatternFly
modifier style (.#{$pf-prefix}icon_rh-ui, .#{$pf-prefix}icons-set_rh-ui,
.#{$pf-prefix}icon_default) which deviates from PF BEM conventions; rename these
to hyphenated, PF modifier-style names (for example .#{$pf-prefix}icon-rh-ui ->
.#{$pf-prefix}icon--rh-ui or .#{$pf-prefix}icon.pf-m-rh-ui, and
.#{$pf-prefix}icons-set_rh-ui -> .#{$pf-prefix}icons-set.pf-m-rh-ui or
.#{$pf-prefix}icons-set--rh-ui, and .#{$pf-prefix}icon_default ->
.#{$pf-prefix}icon--default or .#{$pf-prefix}icon.pf-m-default) and update the
selectors in patternfly-svg-icons.scss (the rules around
.#{$pf-prefix}icon_rh-ui, .#{$pf-prefix}icons-set_rh-ui, and
.#{$pf-prefix}icon_default) accordingly; also search and replace all usages
across the codebase to keep HTML/JS references consistent and run the project's
stylelint/rg checks to ensure naming now matches existing PF patterns (pf-m or
pf-t) and no underscores remain.
- Around line 14-22: Replace the use of display: revert on the
.#{$pf-prefix}icon_rh-ui rule with an explicit display value to avoid unintended
overrides by future cascade rules; update the selector
.#{$pf-prefix}icons-set_rh-ui .#{$pf-prefix}icon_rh-ui to use display: inline
(or another explicit display appropriate for inner <svg> elements) instead of
revert so the nested SVGs render predictably regardless of later stylesheet
changes.
|
🎉 This PR is included in version 6.5.0-prerelease.41 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Closes #8072.
Adds class for a default/PF icon (
pf-v6-icon-default), a RH-ui set icon (pf-v6-icon-rh-ui), and a class to control when RH-ui icons should be displayed instead of PF icons (pf-v6-icons-rh-ui).The svg for an icon that has a mapping between PF + RH icons will have a nested structure, with an outer svg containing most of the shared properties &
pf-v6-svg, and two inner svgs (one withpf-v6-icon-defaultand one withpf-v6-icon-rh-ui) that contain their respective path data and viewbox properties.Let me know what you think about these class names, I'm open to suggestions & not 100% on the preference between hyphens and underscores.
Summary by CodeRabbit