summaryrefslogtreecommitdiff
path: root/src/components/GifButtons.astro
diff options
context:
space:
mode:
authorseth <[email protected]>2024-10-09 10:59:13 -0400
committerGitHub <[email protected]>2024-10-09 10:59:13 -0400
commitd17bca56238e9ca326d60e58230d0d354f23bfe8 (patch)
tree12aee4c37a1490914e6307ce1b0023be2df93105 /src/components/GifButtons.astro
parent7d6495399d5e1ba429a339de1c3a00f121e89305 (diff)
back to astro for hopefully the last time (#146)
Diffstat (limited to 'src/components/GifButtons.astro')
-rw-r--r--src/components/GifButtons.astro58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/components/GifButtons.astro b/src/components/GifButtons.astro
new file mode 100644
index 0000000..3c88dbd
--- /dev/null
+++ b/src/components/GifButtons.astro
@@ -0,0 +1,58 @@
+---
+import type { ImageMetadata } from "astro";
+import { Image } from "astro:assets";
+
+const gifs = import.meta.glob<{ default: ImageMetadata }>(
+ "/src/assets/buttons/*.{gif,svg}",
+);
+
+const gifButtons = [
+ { buttonName: "acab.gif", altText: "ACAB!" },
+ {
+ buttonName: "arnold.gif",
+ altText: "Hey Arnold!",
+ },
+ {
+ buttonName: "capitalism.gif",
+ altText: "Let's crush capitalism!",
+ },
+ {
+ buttonName: "legalize.gif",
+ altText: "Legalize marijuana now!",
+ },
+ {
+ buttonName: "poweredbynix.svg",
+ altText: "Powered by NixOS",
+ link: "https://github.com/sakecode",
+ },
+ {
+ buttonName: "pride.gif",
+ altText: "LGBTQ Pride now!",
+ },
+ {
+ buttonName: "steam.gif",
+ altText: "Play on Steam!",
+ link: "https://dnsense.pub/",
+ },
+ { buttonName: "weezer.gif", altText: "Weezer fan" },
+];
+---
+
+<div class="gif-buttons">
+ {
+ gifButtons.map(({ buttonName, altText, link }) => {
+ const imageTag = (
+ <Image
+ src={gifs[`/src/assets/buttons/${buttonName}`]()}
+ alt={altText}
+ />
+ );
+
+ return (
+ <div class="gif-button">
+ {link ? <a href={link}>{imageTag}</a> : imageTag}
+ </div>
+ );
+ })
+ }
+</div>