// {({ className, style, tokens, getLineProps, getTokenProps }) => (
//
// {tokens.map((line, i) => (
//
// {line.map((token, key) => (
//
// ))}
//
// ))}
//
// )}
//
// );
// };
import React from "react";
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
import CodeStyle from "./CodeStyles";
import styled from "styled-components";
const copyToClipboard = (text: string) => {
const el = document.createElement("textarea");
el.value = text;
document.body.appendChild(el);
el.select();
document.execCommand("copy");
document.body.removeChild(el);
};
interface copyButtonProps {
value?: string;
}
const CodeWrapper = styled.div`
position: relative;
`;
const CopyCodeButton = ({ value }: copyButtonProps) => {
const [copied, setCopied] = React.useState(false);
const clickEvent = () => {
setCopied(true);
copyToClipboard(value || "");
setTimeout(() => {
setCopied(false);
}, 2000);
};
return (