"use client";
import { cn } from "@/lib/utils";
import { CheckIcon, ClipboardIcon } from "lucide-react";
import { useEffect, useState } from "react";
import { toast } from "sonner";
import { Card } from "./card";
export default function CodeCopyButton({
children,
}: {
children: React.ReactNode;
}) {
const [hasCopied, setHasCopied] = useState(false);
const isMobile = window.innerWidth <= 640;
useEffect(() => {
if (hasCopied) {
setTimeout(() => {
setHasCopied(false);
}, 2000);
}
}, [hasCopied]);
const handleCopy = (type: string, value: any) => {
navigator.clipboard.writeText(value);
setHasCopied(true);
// toast.success(`copied ${type} to clipboard`, {
// icon: