Skip to content

Commit b55c97b

Browse files
committed
add warning for set being specified without rhui icon data
1 parent 25bccbe commit b55c97b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/react-icons/src/createIcon.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ export function createIcon({ name, icon, rhUiIcon = null }: CreateIconProps): Re
8484
classNames.push(propsClassName);
8585
}
8686

87+
if (set === 'rh-ui' && rhUiIcon === null) {
88+
// eslint-disable-next-line no-console
89+
console.warn(
90+
`Set "rh-ui" was provided for ${name}, but no rh-ui icon data exists for this icon. The default icon will be rendered.`
91+
);
92+
}
93+
8794
if ((set === undefined && rhUiIcon === null) || set !== undefined) {
8895
const iconData = set !== undefined && set === 'rh-ui' && rhUiIcon !== null ? rhUiIcon : icon;
8996
const { xOffset, yOffset, width, height, svgPathData, svgClassName } = iconData ?? {};

0 commit comments

Comments
 (0)