Files
TitularesApp/frontend/src/components/ConfirmationModal.tsx

46 lines
1.1 KiB
TypeScript

// frontend/src/components/ConfirmationModal.tsx
import { Modal, Box, Typography, Button, Stack } from '@mui/material';
const style = {
position: 'absolute' as 'absolute',
top: '40%',
left: '50%',
transform: 'translate(-50%, -50%)',
width: 400,
bgcolor: 'background.paper',
boxShadow: 24,
p: 4,
borderRadius: 1,
};
interface Props {
open: boolean;
onClose: () => void;
onConfirm: () => void;
title: string;
message: string;
}
const ConfirmationModal = ({ open, onClose, onConfirm, title, message }: Props) => {
return (
<Modal open={open} onClose={onClose}>
<Box sx={style}>
<Typography variant="h6" component="h2" gutterBottom>
{title}
</Typography>
<Typography sx={{ mb: 3, color: 'text.secondary' }}>
{message}
</Typography>
<Stack direction="row" spacing={2} justifyContent="flex-end">
<Button onClick={onClose}>Cancelar</Button>
<Button variant="contained" color="error" onClick={onConfirm}>
Confirmar
</Button>
</Stack>
</Box>
</Modal>
);
};
export default ConfirmationModal;