diff --git a/src/assets/repocube-1.png b/src/assets/repocube-1.png index 465d4c1a..3e1023b8 100644 Binary files a/src/assets/repocube-1.png and b/src/assets/repocube-1.png differ diff --git a/src/assets/repocube-2.png b/src/assets/repocube-2.png index d48f24e9..088feaac 100644 Binary files a/src/assets/repocube-2.png and b/src/assets/repocube-2.png differ diff --git a/src/assets/repocube-3.png b/src/assets/repocube-3.png index 5866eeb4..4f4220d1 100644 Binary files a/src/assets/repocube-3.png and b/src/assets/repocube-3.png differ diff --git a/src/assets/repocube-4.png b/src/assets/repocube-4.png index 6527f5ab..daefd1d7 100644 Binary files a/src/assets/repocube-4.png and b/src/assets/repocube-4.png differ diff --git a/src/components/Header.jsx b/src/components/Header.jsx index 762e6c25..df35f8b2 100644 --- a/src/components/Header.jsx +++ b/src/components/Header.jsx @@ -12,7 +12,8 @@ import { ClickAwayListener, Paper, Grow, - Stack + Stack, + Grid //IconButton } from '@mui/material'; @@ -20,10 +21,19 @@ import { import makeStyles from '@mui/styles/makeStyles'; import logo from '../assets/zotLogo.svg'; //import placeholderProfileButton from '../assets/Profile_button_placeholder.svg'; -import { useState, useRef } from 'react'; +import { useState, useRef, useEffect } from 'react'; import SearchSuggestion from './SearchSuggestion'; const useStyles = makeStyles(() => ({ + barOpen: { + position: 'sticky', + minHeight: '10%' + }, + barClosed: { + position: 'sticky', + minHeight: '10%', + backgroundColor: 'red' + }, header: { display: 'flex', flexDirection: 'row', @@ -64,10 +74,48 @@ const useStyles = makeStyles(() => ({ }, link: { color: '#000' + }, + grid: { + display: 'flex', + flexDirection: 'row', + justifyContent: 'center' } })); +function setNavShow() { + const [show, setShow] = useState(true); + const [lastScrollY, setLastScrollY] = useState(null); + + const controlNavbar = () => { + if (typeof window !== 'undefined') { + if (window.scrollY < lastScrollY) { + // if scroll down hide the navbar + setShow(true); + } else { + setShow(false); + } + + // remember current page location to use in the next move + setLastScrollY(window.scrollY); + } + }; + + useEffect(() => { + if (typeof window !== 'undefined') { + window.addEventListener('scroll', controlNavbar); + + // cleanup function + return () => { + window.removeEventListener('scroll', controlNavbar); + }; + } + }, [lastScrollY]); + return show; +} + function Header() { + const show = setNavShow(); + console.log(show); const classes = useStyles(); const path = useLocation().pathname; // const navigate = useNavigate(); @@ -88,17 +136,23 @@ function Header() { setOpen(false); }; - return ( - + - - zot - - {path !== '/' && } -
- {/* + + + zot + + + + {path !== '/' && } + + +
{''}
+
+ {/* */} - - {({ TransitionProps, placement }) => ( - - - - - Logout - - - - - )} - + + {({ TransitionProps, placement }) => ( + + + + + Logout + + + + + )} + +