"use client"; import { useState } from "react"; import { Button } from "@/components/ui/button"; import { Check, Copy } from "lucide-react"; import { toast } from "sonner"; interface CopyButtonProps { textToCopy: string; } export function CopyButton({ textToCopy }: CopyButtonProps) { const [isCopied, setIsCopied] = useState(false); const handleCopy = () => { if (!textToCopy || textToCopy === "Not found") return; navigator.clipboard.writeText(textToCopy).then(() => { setIsCopied(true); toast.success("Copied to clipboard!"); setTimeout(() => { setIsCopied(false); }, 2000); }); }; return ( ); }