import { useState, useRef, ReactNode } from 'react'; interface Props { children: ReactNode; } const Pre = ({ children }: Props) => { const textInput = useRef(null); const [hovered, setHovered] = useState(false); const [copied, setCopied] = useState(false); const onEnter = () => { setHovered(true); }; const onExit = () => { setHovered(false); setCopied(false); }; const onCopy = () => { setCopied(true); navigator.clipboard.writeText(textInput.current.textContent); setTimeout(() => { setCopied(false); }, 2000); }; return (
{children}