You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
782 B
29 lines
782 B
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;
|
|
|