mirror of
https://bitbucket.org/Mattrixwv/mattrixwvreactcomponents.git
synced 2025-12-06 21:53:57 -05:00
Complete configuration for build
This commit is contained in:
@@ -14,7 +14,7 @@ const toastInitialState: ToastProviderState = {
|
||||
addDanger: () => ""
|
||||
};
|
||||
|
||||
export const ToasterProviderContext = createContext<ToastProviderState>(toastInitialState);
|
||||
const ToasterProviderContext = createContext<ToastProviderState>(toastInitialState);
|
||||
|
||||
|
||||
export default function ToasterProvider({
|
||||
@@ -37,7 +37,7 @@ export default function ToasterProvider({
|
||||
return prev.filter((toast) => toast.id !== id);
|
||||
}
|
||||
});
|
||||
}, [ toast ]);
|
||||
}, []);
|
||||
|
||||
const addToast = useCallback((message: React.ReactNode, duration?: number) => {
|
||||
if(!duration){
|
||||
@@ -49,7 +49,7 @@ export default function ToasterProvider({
|
||||
setTimeout(() => hideToast(id), duration);
|
||||
|
||||
return id;
|
||||
}, [ toast ]);
|
||||
}, [hideToast]);
|
||||
|
||||
const addSuccess = useCallback((message: React.ReactNode, duration?: number) => {
|
||||
return addToast(<SuccessMessageBlock>{message}</SuccessMessageBlock>, duration);
|
||||
@@ -84,6 +84,7 @@ export default function ToasterProvider({
|
||||
}
|
||||
|
||||
|
||||
// eslint-disable-next-line react-refresh/only-export-components
|
||||
export function useToaster(){
|
||||
const context = useContext(ToasterProviderContext);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user