import { useState } from 'react'; import { AnimatePresence, motion } from 'framer-motion'; import { Icon } from './Icon'; import { cn } from '../lib/utils'; /** Copy plain text with a quiet check-mark confirmation. */ export function CopyButton({ text, label = 'Copy answer' }: { text: string; label?: string }) { const [copied, setCopied] = useState(false); const onCopy = async () => { try { // Strip our [[n]] markers from the copied text. await navigator.clipboard.writeText(text.replace(/\[\[(\d+)\]\]/g, '')); setCopied(true); setTimeout(() => setCopied(false), 1600); } catch { /* clipboard unavailable */ } }; return ( ); }