mirror of
https://github.com/ritz078/transform.git
synced 2026-11-20 16:22:53 +03:00
* update-depenencies * fixes * fixes * fixes * fixes * multiple versions of tailwind css * multiple versions of tailwind css
54 lines
1017 B
TypeScript
54 lines
1017 B
TypeScript
import React from "react";
|
|
import Editor from "@monaco-editor/react";
|
|
import { Pane, Spinner } from "evergreen-ui";
|
|
|
|
export function processSize(size) {
|
|
return !/^\d+$/.test(size) ? size : `${size}px`;
|
|
}
|
|
|
|
interface MonacoProps {
|
|
theme?: string;
|
|
language?: string;
|
|
value?: string;
|
|
width?: number | string;
|
|
height?: number | string;
|
|
options?: any;
|
|
defaultValue?: string;
|
|
onChange: (value: string) => void;
|
|
}
|
|
|
|
export const Monaco: React.FC<MonacoProps> = ({
|
|
language,
|
|
value,
|
|
defaultValue,
|
|
height,
|
|
width,
|
|
options,
|
|
onChange
|
|
}) => {
|
|
return (
|
|
<Editor
|
|
defaultLanguage={language}
|
|
defaultValue={defaultValue}
|
|
value={value}
|
|
height={height}
|
|
width={width}
|
|
options={options}
|
|
onChange={onChange}
|
|
loading={
|
|
<Pane
|
|
display="flex"
|
|
alignItems="center"
|
|
justifyContent="center"
|
|
height={400}
|
|
flex={1}
|
|
>
|
|
<Spinner />
|
|
</Pane>
|
|
}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default Monaco;
|