"use client"; import { useState } from "react"; const TABS = [ { id: "humans", label: "For humans", command: "curl -fsSL https://zerolang.ai/install.sh | bash", }, { id: "agents", label: "For agents", command: "npx skills add vercel-labs/zerolang", }, ] as const; type TabId = (typeof TABS)[number]["id"]; export function InstallCopy() { const [activeId, setActiveId] = useState(TABS[0].id); const [copied, setCopied] = useState(false); const active = TABS.find((t) => t.id === activeId) ?? TABS[0]; async function handleCopy() { try { await navigator.clipboard.writeText(active.command); setCopied(true); setTimeout(() => setCopied(false), 1400); } catch {} } return (
{TABS.map((tab, i) => (
{i > 0 && }
))}
$ {active.command}
); }