From e84ca6178576afb04dd926e4facaad7b3bcb8ede Mon Sep 17 00:00:00 2001 From: "Reid \"reidlab" Date: Wed, 21 Aug 2024 23:26:26 -0700 Subject: [PATCH] rewrite badges to allow public directory, add badge --- public/88x31.gif | Bin 0 -> 358 bytes src/components/Badges.astro | 22 ++++++++++++++++++---- src/pages/index.astro | 6 ++++++ 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 public/88x31.gif diff --git a/public/88x31.gif b/public/88x31.gif new file mode 100644 index 0000000000000000000000000000000000000000..da7cd4c880c86467092f16ce6ea8bf9e015247be GIT binary patch literal 358 zcmZ?wbhEHbj9`#w_{hK@AtCX(d&RQH3*Wtar}&@S&ow02*)hP?NY8+ok%56h@h1yI z3d4T}9R>yl29Op8riPaOm8akGFP^jIR`=$6dw%n`J@T0LtaI6`Q`_EgA8$Iq*Tu_Y zu{pbB&+EHZ`+I%UFR)JZe7f*?j*)2Nf#hcgWhZwie4l-xNj#K&8gp;c(PY(V56wlp zx%1z7?tlHTaEsOPCu&=lsQxHd6mKqCcH_kl4oOW*&&bTm&Y3HBp1j!^fYnj`xE*zt zVYiXZiNy+gK8CCRJ@+EFi2IhOhE7=rSMri=#Y{^~RGPGWS(x}^1UP>B@_N3WvBpMS zG`f8|XWf*|X~s7-j~P77cDGzx_CdU2+4rmAF5<22UxQ6W(>IojW*+`Hts^6H($<$h XIi<9$yrQzIx@N7~b?R3j1A{dH-!YzT literal 0 HcmV?d00001 diff --git a/src/components/Badges.astro b/src/components/Badges.astro index 1b4e49f..98aa8d1 100644 --- a/src/components/Badges.astro +++ b/src/components/Badges.astro @@ -18,10 +18,23 @@ const { badges } = Astro.props;
{badges.map((badge) => { - // probably could be a lot cleaner, but i dont care - if (!images[badge.imagePath]) throw new Error(`"${badge.imagePath}" does not exist in glob for wildcard in badges`); - if (badge.href !== undefined) return {badge.alt}; - else return {badge.alt}; + // hopefully we can dedupe this sometime.... + const isTreatedAsPublic = images[badge.imagePath] === undefined; + const hasHref = badge.href !== undefined; + + return <> + {hasHref ? + {isTreatedAsPublic + ? {badge.alt} + : {badge.alt} + } + : <> + {isTreatedAsPublic + ? {badge.alt} + : {badge.alt} + } + } + ; })}