51 lines
1.4 KiB
JavaScript
51 lines
1.4 KiB
JavaScript
import * as React from 'react';
|
|
import Button from '@mui/material/Button';
|
|
|
|
import Dialog from '@mui/material/Dialog';
|
|
import DialogActions from '@mui/material/DialogActions';
|
|
import DialogContent from '@mui/material/DialogContent';
|
|
import DialogContentText from '@mui/material/DialogContentText';
|
|
import DialogTitle from '@mui/material/DialogTitle';
|
|
|
|
export default function FormDialog( {open, setOpen, title, contentText, children} ) {
|
|
|
|
const handleClickOpen = () => {
|
|
setOpen(true);
|
|
};
|
|
|
|
const handleClose = () => {
|
|
setOpen(false);
|
|
};
|
|
|
|
return (
|
|
<React.Fragment>
|
|
<Dialog
|
|
open={open}
|
|
onClose={handleClose}
|
|
PaperProps={{
|
|
component: 'form',
|
|
onSubmit: (event) => {
|
|
event.preventDefault();
|
|
const formData = new FormData(event.currentTarget);
|
|
const formJson = Object.fromEntries(formData.entries());
|
|
const email = formJson.email;
|
|
console.log(email);
|
|
handleClose();
|
|
},
|
|
}}
|
|
>
|
|
<DialogTitle>{title}</DialogTitle>
|
|
<DialogContent>
|
|
<DialogContentText>
|
|
{contentText}
|
|
</DialogContentText>
|
|
{children}
|
|
</DialogContent>
|
|
<DialogActions>
|
|
<Button onClick={handleClose}>취소</Button>
|
|
<Button type="submit">저장</Button>
|
|
</DialogActions>
|
|
</Dialog>
|
|
</React.Fragment>
|
|
);
|
|
} |