From 921248b5c6e394c82cbf958276fecc4c6b7e75fc Mon Sep 17 00:00:00 2001 From: przeq piciel Date: Mon, 9 Sep 2024 15:38:48 +0000 Subject: [PATCH] feat: texteditor component --- app/components/TextEditor/index.tsx | 40 +++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 app/components/TextEditor/index.tsx diff --git a/app/components/TextEditor/index.tsx b/app/components/TextEditor/index.tsx new file mode 100644 index 0000000..2acadf6 --- /dev/null +++ b/app/components/TextEditor/index.tsx @@ -0,0 +1,40 @@ +import { useState } from "react"; +import MonacoEditor, { OnChange } from "@monaco-editor/react"; + +interface EditorProps { + height?: string; + width?: string; + theme?: string; + language?: string; + onChange?: OnChange; +} + +const Editor = (props: EditorProps) => { + const [code, setCode] = useState('console.log("Hello, Monaco!");'); + + const handleEditorChange: OnChange = (value) => { + setCode(value || ""); + }; + + const { + height = "90vh", + width = "100%", + theme = "vs-dark", + language = "typescript", + onChange = handleEditorChange, + } = props; + + return ( + + ); +}; + +export default Editor;