import { ClipboardDocumentIcon } from "@heroicons/react/24/outline"; import { prismThemes } from "@/data/themes/prism"; import { Highlight } from "prism-react-renderer"; import { useTheme } from "@/hooks/useTheme"; import { Fragment, useMemo } from "react"; import { Button } from "./Button"; import Prism from "prismjs"; import { toast } from "react-toastify"; export default function CSRFence({ children, language }: { children: string; language: string }) { const { theme } = useTheme(); const prismTheme = useMemo(() => { return prismThemes[theme]; }, [theme]); const copyToClipboard = () => { navigator.clipboard.writeText(children.trimEnd()); toast.success("Code copied to clipboard!"); }; return ( <> {({ className, style, tokens, getTokenProps }) => (
            
              {tokens.map((line, lineIndex) => (
                
                  {line
                    .filter((token) => !token.empty)
                    .map((token, tokenIndex) => (
                      
                    ))}
                  {"\n"}
                
              ))}
            
          
)}
); }