import React from 'react' import {Tooltip} from 'antd'; import {DownloadOutlined, CopyOutlined} from '@ant-design/icons'; import MonacoEditor from 'react-monaco-editor' import { ISchemaCodeProps } from '../utils/types' import {copySchema, downloadSchema} from '../utils/schemaTools' export const SchemaCode: React.FC = ({ schema, onChange }) => { if (typeof schema === 'object') { schema = JSON.stringify(schema, null, '\t') } const styles = { icon: { fontSize: '20px', color: '#fff', paddingRight: '10px' } }; const ToolBar = () => { return (
{copySchema(schema)}} style={styles.icon} /> {downloadSchema(schema)}} style={styles.icon} />
)}; return (
onChange(schema)} value={schema} />
) }