2024-08-26 13:11:47 +02:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
import { Editor } from "@monaco-editor/react";
|
|
|
|
import { EXAMPLE_A1 } from "@/constants";
|
|
|
|
|
|
|
|
interface CodeEditorProps {
|
2024-09-07 09:12:48 +02:00
|
|
|
onChange: (value: string) => void;
|
2024-08-26 13:11:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
const CodeEditor = ({ onChange }: CodeEditorProps) => {
|
2024-09-07 09:12:48 +02:00
|
|
|
return (
|
|
|
|
<div className="bg-white w-full max-w-full">
|
|
|
|
<Editor
|
|
|
|
options={{
|
|
|
|
minimap: {
|
|
|
|
enabled: false
|
|
|
|
}
|
|
|
|
}}
|
|
|
|
height="75vh"
|
|
|
|
theme="vs-dark"
|
|
|
|
defaultValue={EXAMPLE_A1}
|
|
|
|
language={"html"}
|
|
|
|
onChange={(newValue) => onChange(newValue || "")}
|
|
|
|
className="bg-zinc-950 text-white"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
2024-08-26 13:11:47 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
export default CodeEditor;
|