| import { | |
| Button, | |
| Dialog, | |
| DialogActions, | |
| DialogContent, | |
| DialogContentText, | |
| DialogTitle, | |
| } from "@mui/material"; | |
| interface Props { | |
| open: boolean; | |
| title: string; | |
| message: string; | |
| confirmLabel?: string; | |
| confirmColor?: "primary" | "error" | "warning" | "success"; | |
| loading?: boolean; | |
| onConfirm: () => void; | |
| onClose: () => void; | |
| } | |
| export default function ConfirmDialog({ | |
| open, | |
| title, | |
| message, | |
| confirmLabel = "Confirm", | |
| confirmColor = "primary", | |
| loading = false, | |
| onConfirm, | |
| onClose, | |
| }: Props) { | |
| return ( | |
| <Dialog open={open} onClose={onClose} maxWidth="xs" fullWidth> | |
| <DialogTitle sx={{ fontFamily: "Plus Jakarta Sans", fontWeight: 700 }}> | |
| {title} | |
| </DialogTitle> | |
| <DialogContent> | |
| <DialogContentText>{message}</DialogContentText> | |
| </DialogContent> | |
| <DialogActions sx={{ px: 3, pb: 2 }}> | |
| <Button onClick={onClose} color="inherit"> | |
| Cancel | |
| </Button> | |
| <Button | |
| onClick={onConfirm} | |
| variant="contained" | |
| color={confirmColor} | |
| disabled={loading} | |
| > | |
| {confirmLabel} | |
| </Button> | |
| </DialogActions> | |
| </Dialog> | |
| ); | |
| } | |