({
className,
codeString,
codeLanguage,
height = '300px',
}: {
className?: string;
codeString: string;
codeLanguage: string;
height?: string;
})
| 75 | }; |
| 76 | |
| 77 | export const CodeEditor = ({ |
| 78 | className, |
| 79 | codeString, |
| 80 | codeLanguage, |
| 81 | height = '300px', |
| 82 | }: { |
| 83 | className?: string; |
| 84 | codeString: string; |
| 85 | codeLanguage: string; |
| 86 | height?: string; |
| 87 | }) => { |
| 88 | const { currentTheme } = useThemeSwitch(); |
| 89 | const isDarkMode = currentTheme === 'dark'; |
| 90 | |
| 91 | return ( |
| 92 | <div className={cn(className)}> |
| 93 | <Editor |
| 94 | className={ |
| 95 | 'bg-gray-500/20 rounded-lg overflow-hidden h-full flex-grow mt-4' |
| 96 | } |
| 97 | height={height} |
| 98 | language={codeLanguage} |
| 99 | value={codeString} |
| 100 | beforeMount={beforeEditorMount} |
| 101 | options={ |
| 102 | { |
| 103 | ...MONACO_OPTIONS, |
| 104 | automaticLayout: true, |
| 105 | readOnly: true, |
| 106 | } as monaco.editor.IStandaloneEditorConstructionOptions |
| 107 | } |
| 108 | theme={isDarkMode ? DARK_THEME : LIGHT_THEME} |
| 109 | /> |
| 110 | </div> |
| 111 | ); |
| 112 | }; |
nothing calls this directly
no test coverage detected