'use client' import copy from 'copy-to-clipboard' import { t } from 'i18next' import * as React from 'react' import { useEffect, useState } from 'react' import CopyFeedback from '@/app/components/base/copy-feedback' import Tooltip from '@/app/components/base/tooltip' type IInputCopyProps = { value?: string className?: string children?: React.ReactNode } const InputCopy = ({ value = '', className, children, }: IInputCopyProps) => { const [isCopied, setIsCopied] = useState(false) useEffect(() => { if (isCopied) { const timeout = setTimeout(() => { setIsCopied(false) }, 1000) return () => { clearTimeout(timeout) } } }, [isCopied]) return (
{children}
{ copy(value) setIsCopied(true) }} > {value}
) } export default InputCopy