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/DateModal.jsx | 45 +++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 src/views/Modals/Inputs/DateModal.jsx

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

diff --git a/src/views/Modals/Inputs/DateModal.jsx b/src/views/Modals/Inputs/DateModal.jsx
new file mode 100644
index 0000000..34319c3
--- /dev/null
+++ b/src/views/Modals/Inputs/DateModal.jsx
@@ -0,0 +1,45 @@
+import React, { useState } from 'react'
+import {
+  Modal,
+  Button,
+  Input,
+  ModalDialog,
+  ModalClose,
+  Box,
+  Typography,
+} from '@mui/joy'
+
+function DateModal({ isOpen, onClose, onSave, current, title }) {
+  const [date, setDate] = useState(
+    current ? new Date(current).toISOString().split('T')[0] : null,
+  )
+
+  const handleSave = () => {
+    onSave(date)
+    onClose()
+  }
+
+  return (
+    <Modal open={isOpen} onClose={onClose}>
+      <ModalDialog>
+        {/* <ModalClose /> */}
+        <Typography variant='h4'>{title}</Typography>
+        <Input
+          sx={{ mt: 3 }}
+          type='date'
+          value={date}
+          onChange={e => setDate(e.target.value)}
+        />
+        <Box display={'flex'} justifyContent={'space-around'} mt={1}>
+          <Button onClick={handleSave} fullWidth sx={{ mr: 1 }}>
+            Save
+          </Button>
+          <Button onClick={onClose} variant='outlined'>
+            Cancel
+          </Button>
+        </Box>
+      </ModalDialog>
+    </Modal>
+  )
+}
+export default DateModal
-- 
cgit 

