diff --git a/frontend/src/Navbar.tsx b/frontend/src/Navbar.tsx index 9b75351..0550fb5 100644 --- a/frontend/src/Navbar.tsx +++ b/frontend/src/Navbar.tsx @@ -129,7 +129,6 @@ const rules = ( ); const Navbar: React.FC = () => { const [sidebarOpen, setSidebarOpen] = useState(false); - const auth = useAuth(); const modal = useModal(); const navigate = useNavigate(); @@ -194,96 +193,99 @@ const Navbar: React.FC = () => { )} - {sidebarOpen && ( -
-
- - {auth.isLoggedIn() ? ( - <> -
- {auth.getUser()?.name} -
- - - ) : ( - <> - - - )} -
+
+
+ + {auth.isLoggedIn() ? ( + <> +
+ {auth.getUser()?.name} +
-
-
+ + ) : ( + <> -
+ + )} +
+ +
+
+
-
- )} +
+
); }; diff --git a/frontend/src/index.css b/frontend/src/index.css index 9d5282c..c7224e1 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -52,3 +52,25 @@ body { -1.35px 1.35px 0 black, 1.35px 1.35px 0 black; } + +.fade-enter { + display: none; + opacity: 0; +} + +.fade-enter-active { + display: block; + opacity: 1; + transition: opacity 500ms; +} + +.fade-exit { + display: block; + opacity: 1; +} + +.fade-exit-active { + opacity: 0; + transition: opacity 500ms; + display: none; +} diff --git a/frontend/src/library/modal/Modal.tsx b/frontend/src/library/modal/Modal.tsx index 659eff0..f8d196a 100644 --- a/frontend/src/library/modal/Modal.tsx +++ b/frontend/src/library/modal/Modal.tsx @@ -7,6 +7,7 @@ type ModalContainerProps = { buttons: ModalButtonArgs[]; size: 'small' | 'large'; closeOnBlurClick?: boolean; // Add close prop + isVisible: boolean; }; const Modal: React.FC = ({ @@ -14,6 +15,7 @@ const Modal: React.FC = ({ buttons, size, closeOnBlurClick = true, + isVisible, }) => { const { hide } = useModal(); const modalRef = useRef(null); @@ -35,7 +37,7 @@ const Modal: React.FC = ({ return () => document.removeEventListener('keydown', handleEscape); }, [hide, closeOnBlurClick]); let modalClass = - 'bg-[rgb(222,209,209)] p-5 rounded-xl border-4 border-black shadow-md flex flex-col gap-10 items-center justify-center'; + 'bg-[rgb(222,209,209)] p-5 rounded-xl border-4 border-black shadow-md flex flex-col gap-10 items-center justify-center transition-all duration-500 transform'; if (size === 'small') { modalClass += ' w-11/12 h-1/2 sm:w-1/2 sm:h-1/2 md:w-1/3 md:h-1/3'; @@ -47,9 +49,11 @@ const Modal: React.FC = ({
-
+
{content} {buttons.map((button) => { return ( diff --git a/frontend/src/library/modal/ModalContext.tsx b/frontend/src/library/modal/ModalContext.tsx index a15d9c4..96c587c 100644 --- a/frontend/src/library/modal/ModalContext.tsx +++ b/frontend/src/library/modal/ModalContext.tsx @@ -73,7 +73,9 @@ export const ModalProvider: React.FC = ({ children }) => { function hide() { setcurrentlyActiveModalId(null); setIsVisible(false); - setModalContent(null); + setTimeout(() => { + setModalContent(null); + }, 500); } function updateContent(id: string, content: ReactNode) { if (id === currentlyActiveModalId) { @@ -84,12 +86,13 @@ export const ModalProvider: React.FC = ({ children }) => { return ( {children} - {isVisible && ( + {modalContent && ( )}