From 69e584cea6d33ec91ac27e58e7a2a545aa469a6f Mon Sep 17 00:00:00 2001 From: z0x Date: Sun, 1 Jun 2025 11:40:23 -0400 Subject: [PATCH] feat(index): replace inline svg with lucide icons & make logo unselectable --- astro.config.ts | 5 ++- package.json | 2 ++ src/components/Links.astro | 65 ++++++-------------------------------- src/components/Logo.astro | 2 +- src/js/index.ts | 25 --------------- src/styles/globals.css | 4 +++ 6 files changed, 20 insertions(+), 83 deletions(-) diff --git a/astro.config.ts b/astro.config.ts index b149555..5aea496 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -1,7 +1,10 @@ -import tailwindcss from "@tailwindcss/vite"; import { defineConfig } from "astro/config"; +import tailwindcss from "@tailwindcss/vite"; +import icon from "astro-icon"; + export default defineConfig({ + integrations: [icon()], vite: { plugins: [tailwindcss()], }, diff --git a/package.json b/package.json index 05a7958..a920d19 100644 --- a/package.json +++ b/package.json @@ -12,9 +12,11 @@ "@astrojs/check": "^0.9.4", "@biomejs/biome": "1.9.4", "@fontsource-variable/geist": "^5.2.6", + "@iconify-json/lucide": "^1.2.45", "@tailwindcss/vite": "^4.1.8", "@types/node": "^22.15.29", "astro": "^5.8.1", + "astro-icon": "^1.1.5", "motion": "^12.15.0", "tailwindcss": "^4.1.8" }, diff --git a/src/components/Links.astro b/src/components/Links.astro index 20e1fa4..11aa739 100644 --- a/src/components/Links.astro +++ b/src/components/Links.astro @@ -1,36 +1,19 @@ +--- +import { Icon } from "astro-icon/components"; +--- diff --git a/src/components/Logo.astro b/src/components/Logo.astro index 23ddee5..412acb2 100644 --- a/src/components/Logo.astro +++ b/src/components/Logo.astro @@ -7,6 +7,6 @@ import logo from "/src/assets/logo.svg"; src={logo} alt="logo" loading="eager" - class="w-48 opacity-0 motion-logo" + class="w-48 select-none opacity-0 motion-logo" fetchpriority="high" /> diff --git a/src/js/index.ts b/src/js/index.ts index c6becdf..8d74add 100644 --- a/src/js/index.ts +++ b/src/js/index.ts @@ -15,28 +15,3 @@ animate( ease: "easeIn", }, ); - -document.addEventListener("keydown", ({ key }: KeyboardEvent) => { - const shortcuts: Record = { - g: "a.git", - b: "a.blog", - m: "a.matrix", - }; - - const selector = shortcuts[key.toLowerCase()]; - if (!selector) return; - - const link = document.querySelector(selector) as HTMLAnchorElement | null; - if (!link?.href) return; - - const a = Object.assign(document.createElement("a"), { - href: link.href, - target: link.target, - rel: link.rel, - style: "display: none", - }); - - document.body.append(a); - a.click(); - a.remove(); -}); diff --git a/src/styles/globals.css b/src/styles/globals.css index 9f5cf73..a4b268a 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -14,6 +14,10 @@ main { @apply flex flex-col flex-auto gap-4 justify-center items-center; } + + [data-icon] { + @apply w-8 h-8; + } } :root {