mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-21 05:16:20 +01:00
remove nested ternary expression
This commit is contained in:
parent
f7086c8aa3
commit
1494458ba6
@ -37,7 +37,16 @@ export default function ResolvedIcon({ icon, width = 32, height = 32, alt = "log
|
|||||||
|
|
||||||
if (prefix === "sh") {
|
if (prefix === "sh") {
|
||||||
const iconName = icon.replace("sh-", "").replace(".svg", "").replace(".png", "").replace(".webp", "");
|
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 (
|
return (
|
||||||
<Image
|
<Image
|
||||||
src={`https://cdn.jsdelivr.net/gh/selfhst/icons@main/${extension}/${iconName}.${extension}`}
|
src={`https://cdn.jsdelivr.net/gh/selfhst/icons@main/${extension}/${iconName}.${extension}`}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user