'use client' import React, { useEffect, useState } from 'react' import copy from 'copy-to-clipboard' import { t } from 'i18next' import s from './style.module.css' import Tooltip from '@/app/components/base/tooltip' type IInputCopyProps = { value?: string className?: string readOnly?: boolean children?: React.ReactNode } const InputCopy = ({ value = '', className, readOnly = true, 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}
{ copy(value) setIsCopied(true) }}>
) } export default InputCopy