"use client"; import { useState } from "react"; import { Check, Copy } from "lucide-react"; import posthog from "posthog-js"; import { getJsDelivrUrl } from "@/components/icons/shared/icon-constants"; interface QuickCommandsProps { slug: string; activeVariant: string; } export function QuickCommands({ slug, activeVariant }: QuickCommandsProps) { const [copiedCmd, setCopiedCmd] = useState(null); const cdnUrl = getJsDelivrUrl(slug, activeVariant); const copyToClipboard = (text: string, key: string) => { navigator.clipboard.writeText(text); setCopiedCmd(key); setTimeout(() => setCopiedCmd(null), 1500); posthog.capture("quick_command_copied", { icon_slug: slug, variant: activeVariant, command_type: key, }); }; return (
{/* CLI */}
CLI npx @thesvg/cli add {slug}
{/* CDN */}
CDN {cdnUrl.replace("https://", "")}
); }