feat: Preparation des modèles Settings pour l'enregistrement SMTP [#17]

This commit is contained in:
Luc SORIGNET
2025-05-05 09:25:07 +02:00
parent 99a882a64a
commit eda6f587fb
33 changed files with 468 additions and 74 deletions

View File

@ -0,0 +1,36 @@
import React, { createContext, useState, useContext } from 'react';
import FlashNotification from '@/components/FlashNotification';
const NotificationContext = createContext();
export const NotificationProvider = ({ children }) => {
const [notification, setNotification] = useState({
message: '',
type: '',
title: '',
});
const showNotification = (message, type = 'info', title = '') => {
setNotification({ message, type, title });
};
const clearNotification = () => {
setNotification({ message: '', type: '', title: '' });
};
return (
<NotificationContext.Provider value={{ showNotification }}>
{notification.message && (
<FlashNotification
title={notification.title}
message={notification.message}
type={notification.type}
onClose={clearNotification}
/>
)}
{children}
</NotificationContext.Provider>
);
};
export const useNotification = () => useContext(NotificationContext);