From 1494458ba671fb72b491d767fc298678455b0fb3 Mon Sep 17 00:00:00 2001 From: Ben Phelps Date: Wed, 11 Sep 2024 16:52:56 +0300 Subject: [PATCH] remove nested ternary expression --- src/components/resolvedicon.jsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/resolvedicon.jsx b/src/components/resolvedicon.jsx index afbe31904..de29c0cdc 100644 --- a/src/components/resolvedicon.jsx +++ b/src/components/resolvedicon.jsx @@ -37,7 +37,16 @@ export default function ResolvedIcon({ icon, width = 32, height = 32, alt = "log if (prefix === "sh") { const iconName = icon.replace("sh-", "").replace(".svg", "").replace(".png", "").replace(".webp", ""); - const extension = icon.endsWith(".svg") ? "svg" : icon.endsWith(".webp") ? "webp" : "png"; + + let extension; + if (icon.endsWith(".svg")) { + extension = "svg"; + } else if (icon.endsWith(".webp")) { + extension = "webp"; + } else { + extension = "png"; + } + return (