Skip to content

Commit

Permalink
Update IconFactory.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
nilscognite committed Nov 25, 2024
1 parent 8788537 commit 57bbf4a
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ const DefaultIcon = (_iconProps: IconProps): JSX.Element => <></>;

export class IconFactory {
private static readonly _icons = new Map<IconName, IconType>(DefaultIcons);
public static install(nameName: IconName, iconType: IconType): void {
IconFactory._icons.set(nameName, iconType);
public static install(iconName: IconName, iconType: IconType): void {
IconFactory._icons.set(iconName, iconType);
}

public static getIcon(nameName: IconName): IconType {
if (nameName === undefined) {
public static getIcon(iconName: IconName): IconType {
if (iconName === undefined) {
return DefaultIcon;
}
return IconFactory._icons.get(nameName) ?? DefaultIcon;
return IconFactory._icons.get(iconName) ?? DefaultIcon;
}
}

Expand Down

0 comments on commit 57bbf4a

Please sign in to comment.