import { FC, useState } from "react"; import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; import { oneDark, oneLight } from "react-syntax-highlighter/dist/cjs/styles/prism"; interface Props { language: string; value: string; lightMode: "light" | "dark"; } export const CodeBlock: FC = ({ language, value, lightMode }) => { const [buttonText, setButtonText] = useState("Copy code"); const copyToClipboard = () => { navigator.clipboard.writeText(value).then(() => { setButtonText("Copied!"); setTimeout(() => { setButtonText("Copy code"); }, 2000); }); }; return (
{value}
); };