Skip to content

Commit

Permalink
fix(Search): pass className to custom icons (#9554)
Browse files Browse the repository at this point in the history
* fix(Search): pass className to custom icons

* chore(Storybook): remove test stories

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
tw15egan and kodiakhq[bot] authored Sep 3, 2021
1 parent b32c61b commit 47cd6ea
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/react/src/components/Search/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,16 @@ export default class Search extends Component {
[`${prefix}--search-close--hidden`]: !hasContent,
});

let customIcon;
if (renderIcon) {
customIcon = React.cloneElement(renderIcon, {
className: `${prefix}--search-magnifier-icon`,
});
}

const searchId = `${id}-search`;
const searchIcon = renderIcon ? (
renderIcon
customIcon
) : (
<Search16 className={`${prefix}--search-magnifier-icon`} />
);
Expand Down

0 comments on commit 47cd6ea

Please sign in to comment.