import React, { useRef, useState, useEffect } from 'react'; import { Tooltip, Typography } from 'antd'; import { CopyOutlined, CheckOutlined } from '@ant-design/icons'; import { CopyToClipboard } from 'react-copy-to-clipboard'; const { Link } = Typography; const Copy = ({ text }: { text: string }) => { const [copied, setCopied] = useState(false); const copyIdRef = useRef(); const copyText = (e?: React.MouseEvent) => { e?.preventDefault(); e?.stopPropagation(); setCopied(true); cleanCopyId(); copyIdRef.current = window.setTimeout(() => { setCopied(false); }, 3000); }; const cleanCopyId = () => { window.clearTimeout(copyIdRef.current!); }; return ( {copied ? : } ); }; export default Copy;