first-update
This commit is contained in:
23
easy-dataset-main/components/common/MessageAlert.js
Normal file
23
easy-dataset-main/components/common/MessageAlert.js
Normal file
@@ -0,0 +1,23 @@
|
||||
'use client';
|
||||
|
||||
import { Snackbar, Alert } from '@mui/material';
|
||||
|
||||
export default function MessageAlert({ message, onClose }) {
|
||||
if (!message) return null;
|
||||
|
||||
const severity = message.severity || 'error';
|
||||
const text = typeof message === 'string' ? message : message.message;
|
||||
|
||||
return (
|
||||
<Snackbar
|
||||
open={Boolean(message)}
|
||||
autoHideDuration={2000}
|
||||
onClose={onClose}
|
||||
anchorOrigin={{ vertical: 'top', horizontal: 'center' }}
|
||||
>
|
||||
<Alert onClose={onClose} severity={severity} sx={{ width: '100%' }}>
|
||||
{text}
|
||||
</Alert>
|
||||
</Snackbar>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user