mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2025-06-16 13:46:16 +02:00
Format all files with Prettier
This commit is contained in:
@ -22,9 +22,12 @@ function AlertContextProvider({ children }) {
|
||||
const { AlertContext } = window;
|
||||
const [alert, setAlert] = useState(null);
|
||||
|
||||
const setAlertWrapper = useCallback((message, type = ALERT_TYPES.DANGER) => {
|
||||
setAlert({ message, type });
|
||||
}, [setAlert]);
|
||||
const setAlertWrapper = useCallback(
|
||||
(message, type = ALERT_TYPES.DANGER) => {
|
||||
setAlert({ message, type });
|
||||
},
|
||||
[setAlert]
|
||||
);
|
||||
|
||||
const dismissAlert = useCallback(() => setAlert(null), [setAlert]);
|
||||
|
||||
@ -38,7 +41,7 @@ function AlertContextProvider({ children }) {
|
||||
</Portal>
|
||||
)}
|
||||
<AlertContext.Provider value={[setAlertWrapper, dismissAlert]}>
|
||||
{ children }
|
||||
{children}
|
||||
</AlertContext.Provider>
|
||||
</>
|
||||
);
|
||||
|
@ -1,4 +1,5 @@
|
||||
It provides alert context to children. `AlertContext` allows using `useAlert` in components.
|
||||
It provides alert context to children. `AlertContext` allows using `useAlert` in
|
||||
components.
|
||||
|
||||
Notice that `<div id="alert-container"/>` should be presented in HTML doc to get it work (In reForis it's already done
|
||||
with base Jinja2 templates).
|
||||
Notice that `<div id="alert-container"/>` should be presented in HTML doc to get
|
||||
it work (In reForis it's already done with base Jinja2 templates).
|
||||
|
@ -6,9 +6,7 @@
|
||||
*/
|
||||
|
||||
import React from "react";
|
||||
import {
|
||||
render, getByText, queryByText, fireEvent,
|
||||
} from "customTestRender";
|
||||
import { render, getByText, queryByText, fireEvent } from "customTestRender";
|
||||
|
||||
import { useAlert, AlertContextProvider } from "../AlertContext";
|
||||
|
||||
@ -31,7 +29,7 @@ describe("AlertContext", () => {
|
||||
const { container } = render(
|
||||
<AlertContextProvider>
|
||||
<AlertTest />
|
||||
</AlertContextProvider>,
|
||||
</AlertContextProvider>
|
||||
);
|
||||
componentContainer = container;
|
||||
});
|
||||
|
Reference in New Issue
Block a user