-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[components] Use internal Icon
component for ToggleGroupControlOptionIcon
#40717
[components] Use internal Icon
component for ToggleGroupControlOptionIcon
#40717
Conversation
Icon
component to support dashiconsIcon
component to support dashicons
Icon
component to support dashiconsIcon
component for ToggleGroupControlOptionIcon
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.
Makes sense, thank you!
One small thing before we merge, could you add an entry in the components changelog so people can know about this nice enhancement?
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.
On top of what @mirka said, I also wanted to flag that you won't be able to use Dashicons in Storybook at the moment (see #33984) — furthermore, although Dashicons are not deprecated, their use is currently not encouraged (cc @youknowriad who may be able to give more details on this).
Yes, the only reason the Dashicon component is not officially deprecated is because blocks using the "icon" property can't switch to a component easily. |
@youknowriad - So should this even get merged? I assume the long term plan is to move all the dashicons into the icon library at some point? Happy to add changelog note if still want me to. |
In my opinion, the The Dashicons "deprecation" process seems complex and should be handled separately from this issue (plus, once we deprecated dashicons, we will have to make changes to the |
Changelog note added. Thanks for the feedback and quick reviews. |
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.
Cool, thanks Daniel! 🚀
What?
Trying to use dashicon style string based icon props for the
<ToggleGroupControlOptionIcon>
component would throw errors expecting a component and getting a string.This fix corrects that by switching to the more versatile
<Icon>
from@wordpress/componenets
Why?
<ToggleGroupControlOptionIcon>
was using the SVG based<Icon>
component from@wordpress/icons
which does not support dashicon based strings.How?
Switched from importing Icon from
@wordpress/icons
to importing it as internal from within@wordpress/components
.Testing Instructions
Screenshots or screencast