Files
HKSingleParty/03_source/frontend/src/components/custom-dialog/confirm-dialog.tsx
louiscklaw 98bc3fe3ce update,
2025-05-30 01:13:54 +08:00

31 lines
1003 B
TypeScript

import Button from '@mui/material/Button';
import Dialog from '@mui/material/Dialog';
import DialogTitle from '@mui/material/DialogTitle';
import DialogActions from '@mui/material/DialogActions';
import DialogContent from '@mui/material/DialogContent';
import type { ConfirmDialogProps } from './types';
import { useTranslation } from 'react-i18next';
// ----------------------------------------------------------------------
export function ConfirmDialog({ open, title, action, content, onClose, ...other }: ConfirmDialogProps) {
const { t } = useTranslation();
return (
<Dialog fullWidth maxWidth="xs" open={open} onClose={onClose} {...other}>
<DialogTitle sx={{ pb: 2 }}>{title}</DialogTitle>
{content && <DialogContent sx={{ typography: 'body2' }}> {content} </DialogContent>}
<DialogActions>
{action}
<Button variant="outlined" color="inherit" onClick={onClose}>
{t('Cancel')}
</Button>
</DialogActions>
</Dialog>
);
}