From bf57762570cd757060761eb0fd86519b23bf441d Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Mon, 27 Mar 2023 20:43:05 -0300 Subject: [PATCH] created code modal --- .../src/modals/codeAreaModal/index.tsx | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 src/frontend/src/modals/codeAreaModal/index.tsx diff --git a/src/frontend/src/modals/codeAreaModal/index.tsx b/src/frontend/src/modals/codeAreaModal/index.tsx new file mode 100644 index 000000000..1d53cf134 --- /dev/null +++ b/src/frontend/src/modals/codeAreaModal/index.tsx @@ -0,0 +1,125 @@ +import { Dialog, Transition } from "@headlessui/react"; +import { XMarkIcon, CommandLineIcon } from "@heroicons/react/24/outline"; +import { Fragment, useContext, useRef, useState } from "react"; +import { PopUpContext } from "../../contexts/popUpContext"; +import CodeEditor from "@uiw/react-textarea-code-editor"; + +export default function CodeAreaModal({ + value, + setValue, +}: { + setValue: (value: string) => void; + value: string | string[]; +}) { + const [open, setOpen] = useState(true); + const [code, setCode] = useState(value); + const { closePopUp } = useContext(PopUpContext); + const ref = useRef(); + function setModalOpen(x: boolean) { + setOpen(x); + if (x === false) { + setTimeout(() => { + closePopUp(); + }, 300); + } + } + return ( + + + +
+ + +
+
+ + +
+ +
+
+
+
+
+
+ + Edit Code + +
+
+
+
+
+ {/* need to insert code editor */} + { + setCode(e.target.value); + setValue(e.target.value); + }} + language={"python"} + placeholder="please insert your code here" + className="w-full h-full overflow-auto scrollbar-hide" + /> + + {/*