This commit is contained in:
Reid 2024-07-04 16:48:57 -07:00
commit 0a1187788c
Signed by: reidlab
GPG key ID: DAF5EAF6665839FD
49 changed files with 11570 additions and 0 deletions

View file

@ -0,0 +1,42 @@
---
import { Image } from "astro:assets";
import type { ImageMetadata } from "astro";
const images = import.meta.glob<{ default: ImageMetadata }>("../assets/badges/*.*");
interface Props {
badges: {
href?: string,
title?: string,
alt: string,
imagePath: string
}[]
}
const { badges } = Astro.props;
---
<div class="badges">
{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 <a href={badge.href} target="_blank" rel="noreferrer noopener"><Image src={images[badge.imagePath]()} alt={badge.alt} title={badge.title} quality={100} loading="lazy"/></a>;
else return <Image src={images[badge.imagePath]()} alt={badge.alt} title={badge.title} quality={100} loading="lazy"/>;
})}
</div>
<style>
.badges {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: .2em;
margin-top: 1.25em;
margin-bottom: 1.25em;
& a {
width: 88px;
height: 31px;
}
}
</style>