diff --git a/Client/src/Components/Dialog/genericDialog.jsx b/Client/src/Components/Dialog/genericDialog.jsx index 2807b2e8c..eb1c287d3 100644 --- a/Client/src/Components/Dialog/genericDialog.jsx +++ b/Client/src/Components/Dialog/genericDialog.jsx @@ -1,10 +1,15 @@ -import { Modal, Stack } from "@mui/material"; +import { useId } from "react"; import PropTypes from "prop-types"; +import { Modal, Stack, Typography } from "@mui/material"; + const GenericDialog = ({ title, description, open, onClose, theme, children }) => { + const titleId = useId(); + const descriptionId = useId(); + const ariaDescribedBy = description?.length > 0 ? descriptionId : ""; return ( @@ -27,6 +32,23 @@ const GenericDialog = ({ title, description, open, onClose, theme, children }) = }, }} > + + {title} + + {description && ( + + {description} + + )} {children} @@ -35,7 +57,7 @@ const GenericDialog = ({ title, description, open, onClose, theme, children }) = GenericDialog.propTypes = { title: PropTypes.string.isRequired, - description: PropTypes.string.isRequired, + description: PropTypes.string, open: PropTypes.bool.isRequired, onClose: PropTypes.func.isRequired, theme: PropTypes.object.isRequired, diff --git a/Client/src/Components/Dialog/index.jsx b/Client/src/Components/Dialog/index.jsx index 2053304ee..d138ab983 100644 --- a/Client/src/Components/Dialog/index.jsx +++ b/Client/src/Components/Dialog/index.jsx @@ -1,46 +1,27 @@ -import LoadingButton from "@mui/lab/LoadingButton"; -import { Button, Stack, Typography } from "@mui/material"; import PropTypes from "prop-types"; +import LoadingButton from "@mui/lab/LoadingButton"; +import { Button, Stack } from "@mui/material"; import { GenericDialog } from "./genericDialog"; -import { useId } from "react"; + const Dialog = ({ + title, + description, open, onClose, theme, - title, - description, onCancel, confirmationButtonLabel, onConfirm, isLoading, }) => { - const titleId = useId(); - const descriptionId = useId(); return ( - - {title} - - {description && ( - - {description} - - )} { /> - - Upload Image - { - - - Invite new team member - - - When you add a new team member, they will get access to all monitors. - - { isLoading={buttonLoading} /> setIsOpen(false)} theme={theme} > - - Do you really want to delete this monitor? - - - Once deleted, this monitor cannot be retrieved. - + {/* Make it dialog? */}