({ value, className }: CopyTextButtonProps)
| 9 | }; |
| 10 | |
| 11 | export function CopyTextButton({ value, className }: CopyTextButtonProps) { |
| 12 | const [copied, setCopied] = useState(false); |
| 13 | const onCopied = useCallback(() => { |
| 14 | setCopied(true); |
| 15 | const timeout = setTimeout(() => { |
| 16 | setCopied(false); |
| 17 | }, 1500); |
| 18 | }, [value]); |
| 19 | return ( |
| 20 | <CopyText className={`${className}`} value={value} onCopied={onCopied}> |
| 21 | {copied ? ( |
| 22 | <Body>Copied!</Body> |
| 23 | ) : ( |
| 24 | <div className="flex items-center"> |
| 25 | <ClipboardIcon className="h-4 w-4 mr-[2px]" /> |
| 26 | <Body>Copy</Body> |
| 27 | </div> |
| 28 | )} |
| 29 | </CopyText> |
| 30 | ); |
| 31 | } |
nothing calls this directly
no outgoing calls
no test coverage detected