Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
fix(Icon): prevent error when icon doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Cecilia Woodward committed Aug 24, 2021
1 parent 9b47e09 commit 7544ed5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions stories/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ export function Icon({
}: IconProps): JSX.Element {
const MappedIcon = ICON_MAP[icon];

if (!MappedIcon) {
console.error(`Unknown icon. (${icon})`);
return null;
}

return (
<MappedIcon
className={classNames(
Expand Down

0 comments on commit 7544ed5

Please sign in to comment.