From c4b7d21a5c5ca338aa042d5c9d43feb9c1571adc Mon Sep 17 00:00:00 2001 From: mattyl006 Date: Wed, 12 Oct 2022 09:38:35 +0200 Subject: [PATCH] menu hiding correction --- src/App.js | 12 +++++++++++- src/components/elements/LoggedBar.js | 3 ++- src/components/elements/MobileNavMenu.js | 3 ++- src/components/elements/NavBar/NavBar.js | 16 +++++++++++++--- src/services/KeyCloakService.js | 14 +++++++------- 5 files changed, 35 insertions(+), 13 deletions(-) diff --git a/src/App.js b/src/App.js index 8bccc50..f75d396 100644 --- a/src/App.js +++ b/src/App.js @@ -17,18 +17,28 @@ import LoggedBar from './components/elements/LoggedBar'; const App = () => { const [loggedBarVisible, setLoggedBarVisible] = React.useState('100vw'); + const [loggedBarHover, setLoggedBarHover] = React.useState(false); const loggedBarVisibleHandler = () => { - if (loggedBarVisible === '0') + if (loggedBarVisible === '0' && !loggedBarHover) setLoggedBarVisible('100vw'); else setLoggedBarVisible('0'); }; + const loggedBarHoverTrue = () => { + setLoggedBarHover(true); + }; + + const loggedBarHoverFalse = () => { + setLoggedBarHover(false); + }; + return ( }/> diff --git a/src/components/elements/LoggedBar.js b/src/components/elements/LoggedBar.js index 5079ea7..4f8c3eb 100644 --- a/src/components/elements/LoggedBar.js +++ b/src/components/elements/LoggedBar.js @@ -50,7 +50,8 @@ const LoggedBar = (props) => { return ( - + diff --git a/src/components/elements/MobileNavMenu.js b/src/components/elements/MobileNavMenu.js index 27ebb24..9b5f5b0 100644 --- a/src/components/elements/MobileNavMenu.js +++ b/src/components/elements/MobileNavMenu.js @@ -52,7 +52,8 @@ const MobileNavMenu = (props) => { return ( - + diff --git a/src/components/elements/NavBar/NavBar.js b/src/components/elements/NavBar/NavBar.js index 1214f34..3206341 100644 --- a/src/components/elements/NavBar/NavBar.js +++ b/src/components/elements/NavBar/NavBar.js @@ -33,11 +33,20 @@ const MenuButton = styled(Container)` const NavBar = (props) => { const [navMenuTranslateY, setNavMenuTranslateY] = React.useState('calc(-100vh - 42px)'); + const [mobileMenuHover, setMobileMenuHover] = React.useState(false); + + const mobileMenuHoverTrue = () => { + setMobileMenuHover(true); + }; + + const mobileMenuHoverFalse = () => { + setMobileMenuHover(false); + }; const toggleNavMenu = () => { - if (navMenuTranslateY === 'calc(-100vh - 42px)') + if ((navMenuTranslateY === 'calc(-100vh - 42px)')) setNavMenuTranslateY('0'); - else + else if (!mobileMenuHover) setNavMenuTranslateY('calc(-100vh - 42px)'); }; @@ -76,7 +85,8 @@ const NavBar = (props) => { } - + ); }; diff --git a/src/services/KeyCloakService.js b/src/services/KeyCloakService.js index 7af44f7..b289657 100644 --- a/src/services/KeyCloakService.js +++ b/src/services/KeyCloakService.js @@ -1,17 +1,17 @@ import Keycloak from 'keycloak-js'; -// const _kc = new Keycloak({ -// url: 'https://auth-dev.csi.wmi.amu.edu.pl/', -// realm: 'gonito-dev', -// clientId: 'gonito-dev-localhost' -// }); - const _kc = new Keycloak({ url: 'https://auth-dev.csi.wmi.amu.edu.pl/', realm: 'gonito-dev', - clientId: 'gonito-dev-heroku' + clientId: 'gonito-dev-localhost' }); +// const _kc = new Keycloak({ +// url: 'https://auth-dev.csi.wmi.amu.edu.pl/', +// realm: 'gonito-dev', +// clientId: 'gonito-dev-heroku' +// }); + // const _kc = new Keycloak({ // url: 'http://0.0.0.0:8080', // realm: 'test',