-
-
Notifications
You must be signed in to change notification settings - Fork 114
Expand file tree
/
Copy pathindex.tsx
More file actions
26 lines (24 loc) · 669 Bytes
/
index.tsx
File metadata and controls
26 lines (24 loc) · 669 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { useColorMode } from "@docusaurus/theme-common";
import Editor from "@monaco-editor/react";
import styles from "./index.module.css";
export default function CodeEditor(
props: Readonly<{
readOnly?: boolean;
rulers?: number[];
value?: string;
onChange?: (value: string | undefined) => void;
}>
) {
const { colorMode } = useColorMode();
return (
<div className={styles.editor}>
<Editor
language="java"
options={{ readOnly: props.readOnly, rulers: props.rulers }}
theme={colorMode === "dark" ? "vs-dark" : "light"}
value={props.value}
onChange={props.onChange}
/>
</div>
);
}