Добавил компонент диалога

jwt
Rinsvent 2 years ago
parent 5dfd9e7df6
commit 19891328fc
  1. 41
      components/elements/confirm-dialog/index.tsx
  2. 0
      components/elements/confirm-dialog/styles.module.css

@ -0,0 +1,41 @@
import styles from './styles.module.css'
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';
import { v4 } from "uuid"
interface ConfirmDialogInterface {
open: boolean
closeCallback: any
agreeCallback: any
text: string
}
export default function ConfirmDialog({open, agreeCallback, closeCallback, text}: ConfirmDialogInterface) {
return (
<Dialog
open={open}
onClose={closeCallback}
aria-labelledby="alert-dialog-title"
aria-describedby="alert-dialog-description"
>
<DialogTitle>
{"Are you sure?"}
</DialogTitle>
<DialogContent>
<DialogContentText>
{text}
</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={() => agreeCallback(v4())} autoFocus>
Agree
</Button>
<Button onClick={closeCallback}>Disagree</Button>
</DialogActions>
</Dialog>
);
}
Loading…
Cancel
Save