diff --git a/src/components/PluginCard.astro b/src/components/PluginCard.astro index 15a6512..ba4049b 100644 --- a/src/components/PluginCard.astro +++ b/src/components/PluginCard.astro @@ -1,13 +1,8 @@ --- -import { RUNTIMES } from '../../scripts/registry.mjs'; -// Brand marks from simple-icons (CC0), vendored rather than pulled at build time. `?raw` inlines -// them so each is one path in the HTML instead of four more requests. -import node from '../icons/nodedotjs.svg?raw'; -import deno from '../icons/deno.svg?raw'; -import bun from '../icons/bun.svg?raw'; -import workerd from '../icons/cloudflareworkers.svg?raw'; +import Runtimes from './Runtimes.astro'; interface Props { + slug: string; name: string; description: string; repo: string; @@ -18,52 +13,14 @@ interface Props { internal: boolean; } -const { name, description, repo, version, npm, jsr, runtimes, internal } = Astro.props; - -const ICONS: Record = { node, deno, bun, workerd }; -const LABELS: Record = { - node: 'Node.js', - deno: 'Deno', - bun: 'Bun', - workerd: 'workerd (Cloudflare Workers)', -}; - -// All four are always shown. Colour means the package declares it runs there; dim grey means it -// declared otherwise, or said nothing — the tooltip is what separates those two, because at a -// glance they are the same fact: you cannot use it there. -const runs = (runtime: string) => runtimes.includes(runtime); -const tooltip = (runtime: string) => { - if (runs(runtime)) return `Runs on ${LABELS[runtime]}`; - - return internal - ? `Does not run on ${LABELS[runtime]} — see the README for why` - : `${LABELS[runtime]} not declared by this package`; -}; +const { slug, name, description, repo, version, npm, jsr, runtimes, internal } = Astro.props; ---
{version} -

{name}

+

{name}

-