From fa9e7f4934619f396f6db1e19b847676b9debf59 Mon Sep 17 00:00:00 2001 From: Flo Date: Thu, 20 Jun 2024 09:36:29 +0200 Subject: [PATCH] Better state naming for Modal component Co-authored-by: Maxime Bouveron --- frontend/src/components/Modal/Modal.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/Modal/Modal.tsx b/frontend/src/components/Modal/Modal.tsx index 999ee1f54..77458cd8e 100644 --- a/frontend/src/components/Modal/Modal.tsx +++ b/frontend/src/components/Modal/Modal.tsx @@ -21,8 +21,8 @@ export const Modal: React.FC = ({ className, children }) => { const intl = useIntl(); const ref = useRef(null); - const [show, toggle] = useState(false); - const isFullscreen = useFullscreen(ref, show, { onClose: () => toggle(false) }); + const [show, setShow] = useState(false); + const isFullscreen = useFullscreen(ref, show, { onClose: () => setShow(false) }); return (
@@ -30,7 +30,7 @@ export const Modal: React.FC = ({ className, children }) => { } - onClick={() => toggle(boolean => !boolean)} + onClick={() => setShow(boolean => !boolean)} /> )}
@@ -38,7 +38,7 @@ export const Modal: React.FC = ({ className, children }) => { {typeof children === 'function' ? children({ isFullscreen: show, - toggleFullscreen: () => toggle(boolean => !boolean), + toggleFullscreen: () => setShow(boolean => !boolean), }) : children}