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.
31 lines
815 B
31 lines
815 B
'use client';
|
|
|
|
import { useNotification } from '../context/NotificationContext';
|
|
|
|
const Notification = () => {
|
|
const { notification, clearNotification } = useNotification();
|
|
|
|
if (!notification) return null;
|
|
|
|
const notificationTypeClass = {
|
|
success: 'alert-success',
|
|
error: 'alert-danger',
|
|
warning: 'alert-warning',
|
|
info: 'alert-info',
|
|
}[notification.type] || 'alert-info';
|
|
|
|
return (
|
|
<div className={`alert ${notificationTypeClass} alert-dismissible fade show`} role="alert">
|
|
{notification.message}
|
|
<button
|
|
type="button"
|
|
className="btn-close"
|
|
aria-label="Close"
|
|
onClick={clearNotification}
|
|
></button>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default Notification;
|