From d095923f04b884df0c735a66b035d3d805180b90 Mon Sep 17 00:00:00 2001 From: davidsmejia Date: Sun, 30 Apr 2023 20:25:36 -0400 Subject: [PATCH] add support for simple-icons si- prefix --- src/components/resolvedicon.jsx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/components/resolvedicon.jsx b/src/components/resolvedicon.jsx index d503fe9d..5373474a 100644 --- a/src/components/resolvedicon.jsx +++ b/src/components/resolvedicon.jsx @@ -18,9 +18,16 @@ export default function ResolvedIcon({ icon, width = 32, height = 32, alt = "log ); } - // mdi- prefixed, material design icons - if (icon.startsWith("mdi-")) { - const iconName = icon.replace("mdi-", "").replace(".svg", ""); + const prefix = icon.split("-")[0] + const prefixPaths = { + 'mdi': "https://cdn.jsdelivr.net/npm/@mdi/svg@latest/svg/", + 'si' : "https://cdn.jsdelivr.net/npm/simple-icons@latest/icons/", + }; + + if (prefix in prefixPaths) { + const iconName = icon.replace(`${prefix}-`, "").replace(".svg", ""); + const iconSource = `${prefixPaths[prefix]}${iconName}.svg`; + return (
);