"use client"; import { useState, useRef } from "react"; import { Button } from "@/components/ui/button"; import { Copy, Check } from "lucide-react"; type CopyTextBoxProps = { text?: string; displayText?: string; wrapText?: boolean; outline?: boolean; }; export default function CopyTextBox({ text = "", displayText, wrapText = false, outline = true }: CopyTextBoxProps) { const [isCopied, setIsCopied] = useState(false); const textRef = useRef(null); const copyToClipboard = async () => { if (textRef.current) { try { await navigator.clipboard.writeText(text); setIsCopied(true); setTimeout(() => setIsCopied(false), 2000); } catch (err) { console.error("Failed to copy text: ", err); } } }; return (
                {displayText || text}
            
); }