import Editor from '@monaco-editor/react' import { Check, Copy } from 'lucide-react' import { useMemo, useState } from 'react' import { Button, cn, copyToClipboard } from 'ui' type SqlMonacoBlockProps = { value?: string className?: string wrapperClassName?: string hideCopy?: boolean // Fixed height in px. Defaults to 310 to match previous CodeBlock max height height?: number // Show line numbers. Defaults to false to match previous CodeBlock lineNumbers?: 'on' | 'off' } export const SqlMonacoBlock = ({ value, className, wrapperClassName, height = 310, lineNumbers = 'off', hideCopy = false, }: SqlMonacoBlockProps) => { const [copied, setCopied] = useState(false) const content = useMemo(() => value ?? '', [value]) const handleCopy = (value: string) => { setCopied(true) copyToClipboard(value) setTimeout(() => setCopied(false), 1000) } return (
{!hideCopy && (
)}
) }