MCPcopy Create free account
hub / github.com/PageAI-Pro/page-ui / CodeEditor

Function CodeEditor

components/shared/CodeEditor.tsx:77–112  ·  view source on GitHub ↗
({
  className,
  codeString,
  codeLanguage,
  height = '300px',
}: {
  className?: string;
  codeString: string;
  codeLanguage: string;
  height?: string;
})

Source from the content-addressed store, hash-verified

75};
76
77export 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};

Callers

nothing calls this directly

Calls 2

useThemeSwitchFunction · 0.90
cnFunction · 0.90

Tested by

no test coverage detected