"use client"; import * as React from "react"; import { cn } from "@/lib/utils"; import { Button } from "@/components/retroui"; interface ICodeBlock extends React.HTMLAttributes {} export async function copyToClipboardWithMeta(value: string, event?: Event) { navigator.clipboard.writeText(value); if (event) { // trackEvent(event); } } export function CodeBlock({ className, children, ...props }: ICodeBlock) { const [hasCopied, setHasCopied] = React.useState(false); const preRef = React.useRef(null); const handleClickCopy = async () => { const code = preRef.current?.textContent; if (code) { setHasCopied(true); await navigator.clipboard.writeText(code); setTimeout(() => { setHasCopied(false); }, 3000); } }; return (
        
        {children}
      
); }