Skip to content

Commit

Permalink
fix: fix aws icons not being displayed
Browse files Browse the repository at this point in the history
Closes #1399
  • Loading branch information
mainawycliffe committed Sep 21, 2023
1 parent 7938b56 commit 2b6d86c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/Icon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ function findByName(name?: string) {
return undefined;
}
if (getIconsForAWSEvents(name)) {
return getIconsForAWSEvents(name);
name = getIconsForAWSEvents(name);
}
if (aliases[name as keyof typeof aliases]) {
name = aliases[name as keyof typeof aliases];
}
name = name.replaceAll("::", "-").replaceAll("--", "-").toLowerCase();
name = name?.replaceAll("::", "-").replaceAll("--", "-").toLowerCase();
if (aliases[name as keyof typeof aliases]) {
name = aliases[name as keyof typeof aliases];
}
var icon = Icons[name.toLowerCase() as keyof typeof Icons];
var icon = Icons[name?.toLowerCase() as keyof typeof Icons];
if (icon == null) {
icon = Icons[("aws-" + name) as keyof typeof Icons];
}
Expand All @@ -86,7 +86,7 @@ function findByName(name?: string) {
}

for (let prefix in prefixes) {
if (name.toLowerCase().startsWith(prefix)) {
if (name?.toLowerCase().startsWith(prefix)) {
icon =
Icons[prefixes[prefix as keyof typeof prefixes] as keyof typeof Icons];
}
Expand Down Expand Up @@ -131,7 +131,7 @@ export const Icon: React.FC<IconProps> = memo(
icon = name;
} else if (!isEmpty(name) || !isEmpty(secondary)) {
icon = findByName(name);
if (icon == null) {
if (!icon) {
icon = findByName(secondary);
}
if (icon == null && reactIcons[secondary as keyof typeof reactIcons]) {
Expand Down

0 comments on commit 2b6d86c

Please sign in to comment.