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; } 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 ( {name} {handleClose ? ( ) : null} {children} ); };