parent
54b9539c0f
commit
00b6f7f1c7
@ -0,0 +1,29 @@ |
||||
import React from 'react'; |
||||
import { Snackbar, Alert, AlertColor } from '@mui/material'; |
||||
|
||||
interface MessageAlertProps { |
||||
open: boolean; |
||||
message: string; |
||||
severity: AlertColor; // 'error' | 'warning' | 'info' | 'success'
|
||||
onClose: (event?: React.SyntheticEvent | Event, reason?: string) => void; |
||||
duration?: number; |
||||
} |
||||
|
||||
const MessageAlert: React.FC<MessageAlertProps> = ({ |
||||
open, |
||||
message, |
||||
severity, |
||||
onClose, |
||||
duration = 6000, |
||||
}) => { |
||||
return ( |
||||
<Snackbar open={open} autoHideDuration={duration} onClose={onClose} |
||||
anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }} sx={{bottom: '120px'}}> |
||||
<Alert onClose={onClose} severity={severity} sx={{ width: '100%' }}> |
||||
{message} |
||||
</Alert> |
||||
</Snackbar> |
||||
); |
||||
}; |
||||
|
||||
export default MessageAlert; |
Loading…
Reference in new issue