Добавил компонент диалога
This commit is contained in:
parent
5dfd9e7df6
commit
19891328fc
41
components/elements/confirm-dialog/index.tsx
Normal file
41
components/elements/confirm-dialog/index.tsx
Normal file
@ -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…
Reference in New Issue
Block a user