(value: string)
| 12 | const [isCopied, setIsCopied] = React.useState<Boolean>(false); |
| 13 | |
| 14 | const copyToClipboard = (value: string) => { |
| 15 | if (typeof window === 'undefined' || !navigator.clipboard?.writeText) { |
| 16 | return; |
| 17 | } |
| 18 | |
| 19 | if (!value) { |
| 20 | return; |
| 21 | } |
| 22 | |
| 23 | navigator.clipboard.writeText(value).then(() => { |
| 24 | setIsCopied(true); |
| 25 | |
| 26 | setTimeout(() => { |
| 27 | setIsCopied(false); |
| 28 | }, timeout); |
| 29 | }); |
| 30 | }; |
| 31 | |
| 32 | return { isCopied, copyToClipboard }; |
| 33 | } |
nothing calls this directly
no outgoing calls
no test coverage detected