Skip to content

Commit

Permalink
Merge pull request #189 from 10up/no-icon-fix
Browse files Browse the repository at this point in the history
Only output icon if one is set
  • Loading branch information
fabiankaegy authored Jan 17, 2023
2 parents ac20024 + 9286047 commit 3c7551e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions components/icon-picker/icon-picker-toolbar-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,15 @@ export const IconPickerToolbarButton = (props) => {
buttonLabel,
} = props;

const buttonIcon = name && iconSet ? <Icon name={name} iconSet={iconSet} /> : null;

return (
<Dropdown
className="component-icon-picker-toolbar-button"
contentClassName="component-icon-picker-toolbar-button__content"
position="bottom right"
renderToggle={({ isOpen, onToggle }) => (
<ToolbarButton
onClick={onToggle}
aria-expanded={isOpen}
icon={<Icon name={name} iconSet={iconSet} />}
>
<ToolbarButton onClick={onToggle} aria-expanded={isOpen} icon={buttonIcon}>
{buttonLabel ?? __('Select Icon')}
</ToolbarButton>
)}
Expand Down

0 comments on commit 3c7551e

Please sign in to comment.