import copy from 'copy-to-clipboard'; import { InfoIcon } from 'lucide-react'; import React, { useRef, useState, RefObject } from 'react'; import Clipboard from '~/components/svg/Clipboard'; import CheckMark from '~/components/svg/CheckMark'; import cn from '~/utils/cn'; type CodeBarProps = { lang: string; codeRef: RefObject; plugin?: boolean; error?: boolean; }; type CodeBlockProps = Pick & { codeChildren: React.ReactNode; classProp?: string; }; const CodeBar: React.FC = React.memo(({ lang, codeRef, error, plugin = null }) => { const [isCopied, setIsCopied] = useState(false); return (
{lang} {plugin ? ( ) : ( )}
); }); const CodeBlock: React.FC = ({ lang, codeChildren, classProp = '', plugin = null, error, }) => { const codeRef = useRef(null); const language = plugin || error ? 'json' : lang; return (
{codeChildren}
); }; export default CodeBlock;