(e: React.MouseEvent, text: string)
| 166 | const [copied, setCopied] = useState(false); |
| 167 | |
| 168 | const handleCopy = (e: React.MouseEvent, text: string) => { |
| 169 | e.stopPropagation(); // prevent collapsing when copying |
| 170 | navigator.clipboard.writeText(text); |
| 171 | setCopied(true); |
| 172 | toast({ |
| 173 | title: "Copied to clipboard!", |
| 174 | description: "The code snippet has been copied to your clipboard.", |
| 175 | }); |
| 176 | setTimeout(() => setCopied(false), 2000); |
| 177 | }; |
| 178 | |
| 179 | return ( |
| 180 | <div> |