"use client"; import React from "react"; import { CheckIcon, CopyIcon } from "@radix-ui/react-icons"; import { useTheme } from "next-themes"; import { CodeBlock, dracula, github } from "react-code-blocks"; import { toast } from "sonner"; import { Button } from "./ui/button"; interface ButtonCodeblockProps { code: string; lang: string; } export default function CodeDisplayBlock({ code, lang }: ButtonCodeblockProps) { const [isCopied, setisCopied] = React.useState(false); const { theme } = useTheme(); const copyToClipboard = () => { navigator.clipboard.writeText(code); setisCopied(true); toast.success("Code copied to clipboard!"); setTimeout(() => { setisCopied(false); }, 1500); }; return (
); }