From 2657469964e24ffbeb905024532120395f6e797c Mon Sep 17 00:00:00 2001
From: Mo Tarbin <mhed.t91@gmail.com>
Date: Sun, 30 Jun 2024 18:55:39 -0400
Subject: move to Donetick Org, First commit frontend

---
 src/views/Modals/Inputs/TextModal.jsx | 46 +++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 src/views/Modals/Inputs/TextModal.jsx

(limited to 'src/views/Modals/Inputs/TextModal.jsx')

diff --git a/src/views/Modals/Inputs/TextModal.jsx b/src/views/Modals/Inputs/TextModal.jsx
new file mode 100644
index 0000000..2b44f78
--- /dev/null
+++ b/src/views/Modals/Inputs/TextModal.jsx
@@ -0,0 +1,46 @@
+import { Box, Button, Modal, ModalDialog, Textarea, Typography } from '@mui/joy'
+import { useState } from 'react'
+
+function TextModal({
+  isOpen,
+  onClose,
+  onSave,
+  current,
+  title,
+  okText,
+  cancelText,
+}) {
+  const [text, setText] = useState(current)
+
+  const handleSave = () => {
+    onSave(text)
+    onClose()
+  }
+
+  return (
+    <Modal open={isOpen} onClose={onClose}>
+      <ModalDialog>
+        {/* <ModalClose /> */}
+        <Typography variant='h4'>{title}</Typography>
+        <Textarea
+          placeholder='Type in here…'
+          value={text}
+          onChange={e => setText(e.target.value)}
+          minRows={2}
+          maxRows={4}
+          sx={{ minWidth: 300 }}
+        />
+
+        <Box display={'flex'} justifyContent={'space-around'} mt={1}>
+          <Button onClick={handleSave} fullWidth sx={{ mr: 1 }}>
+            {okText ? okText : 'Save'}
+          </Button>
+          <Button onClick={onClose} variant='outlined'>
+            {cancelText ? cancelText : 'Cancel'}
+          </Button>
+        </Box>
+      </ModalDialog>
+    </Modal>
+  )
+}
+export default TextModal
-- 
cgit 

