diff --git a/client/src/components/Modals/Modal.tsx b/client/src/components/Modals/Modal.tsx index 6fe838f..734f942 100644 --- a/client/src/components/Modals/Modal.tsx +++ b/client/src/components/Modals/Modal.tsx @@ -1,15 +1,74 @@ import React, { FC } from "react"; import Dialog from "@material-ui/core/Dialog"; +import { + DialogTitle, + Typography, + IconButton, + DialogContent, + makeStyles, + Theme, + createStyles, + DialogActions, + Button, +} from "@material-ui/core"; +import CloseIcon from "@material-ui/icons/Close"; interface IProps { handleClose: () => void; show: boolean; + action: string; + handleAction: (e: React.FormEvent) => Promise; + name: string; } -export const Modal: FC = ({ handleClose, show, children }) => { +const useStyles = makeStyles((theme: Theme) => + createStyles({ + root: { + margin: 0, + padding: theme.spacing(2), + }, + closeButton: { + position: "absolute", + right: theme.spacing(1), + top: theme.spacing(1), + color: theme.palette.grey[500], + }, + }) +); + +export const Modal: FC = ({ + handleClose, + show, + action, + handleAction, + children, + name, +}) => { + const classes = useStyles(); + return ( - {children} + + {name} + {handleClose ? ( + + + + ) : null} + + {children} + + + + ); }; diff --git a/client/src/components/Modals/NewTicketModal.tsx b/client/src/components/Modals/NewTicketModal.tsx index 304f932..96056c2 100644 --- a/client/src/components/Modals/NewTicketModal.tsx +++ b/client/src/components/Modals/NewTicketModal.tsx @@ -6,6 +6,21 @@ import { Ticket } from "../../types/Ticket"; import { Project } from "../../types/Project"; import { post } from "../../utils/http"; import { Constants } from "../../utils/Constants"; +import { + DialogTitle, + DialogContent, + DialogContentText, + TextField, + DialogActions, + Button, + Typography, + IconButton, + Theme, + createStyles, + makeStyles, +} from "@material-ui/core"; +import MuiDialogTitle from "@material-ui/core/DialogTitle"; +import MuiDialogContent from "@material-ui/core/DialogContent"; interface IProps { show: boolean; @@ -26,9 +41,7 @@ export const NewTicketModal: FC = ({ const id = url.split("/")[2]; const [projectId, setProjectId] = useState(id); - const handleSubmit: (event: FormEvent) => void = async ( - e: FormEvent - ) => { + const handleSubmit = async (e: FormEvent) => { e.preventDefault(); let newTicket = { title: title, @@ -44,11 +57,17 @@ export const NewTicketModal: FC = ({ }; return ( - +
-
+ {/*

New Ticket

-
+
*/}
= ({ setFilterText(e.target.value); }; - const handleSubmit: (event: FormEvent) => void = async ( - e: FormEvent - ) => { + const handleSubmit = async (e: FormEvent) => { e.preventDefault(); await patch( `${Constants.projectsURI}/${id}/members`, @@ -41,7 +39,13 @@ export const UsersModal: FC = ({ }; return ( - +

Manage users