import type { FC } from 'react' import { useCopyClipboard } from '@crypto-dex-sdk/hooks' import { CheckIcon, DocumentDuplicateIcon } from '@heroicons/react/24/outline' import classNames from 'classnames' import React from 'react' interface CopyHelperProps { className?: string toCopy: string children?: React.ReactNode | ((isCopied: boolean) => React.ReactNode) hideIcon?: boolean } export const CopyHelper: FC = ({ className, toCopy, children, hideIcon }) => { const [isCopied, setCopied] = useCopyClipboard() return (
setCopied(toCopy)}> {isCopied && (
{typeof children === 'function' ? children(isCopied) : children} {!hideIcon && }
)} {!isCopied && (
{typeof children === 'function' ? children(isCopied) : children} {!hideIcon && }
)}
) }