Burger menu now works

repocard
E. Almqvist 2 years ago
parent e09e0083be
commit 1241d92f68
  1. 22
      components/burgermenu.tsx

@ -62,16 +62,19 @@ const BurgerContainer = styled.div<{open: boolean}>`
` `
const BNavCont = styled.nav<{show: boolean}>` const BNavCont = styled.nav<{show: boolean}>`
display: none; display: flex;
opacity: 0;
backdrop-filter: blur(25px); backdrop-filter: blur(25px);
position: fixed; position: fixed;
flex-direction: column; flex-direction: column;
background: #222a; background: #21242baf;
left: 0; left: 0;
top: 0; top: 0;
pointer-events: none;
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
z-index: 2; z-index: 2;
transition: opacity .2s;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
@ -94,12 +97,21 @@ const BNavCont = styled.nav<{show: boolean}>`
${({show}) => show && css` ${({show}) => show && css`
display: flex; display: flex;
opacity: 1;
pointer-events: unset;
`} `}
@media screen and (min-width: 960px) {
display: none;
position: absolute;
top: 0;
}
` `
const BNav: React.FC<{show: boolean}> = ({show}) => { const BNav: React.FC<{show: boolean, onClick: () => void}> = ({show, onClick}) => {
return ( return (
<BNavCont show={show}> <BNavCont show={show} onClick={onClick}>
<NavLinks /> <NavLinks />
</BNavCont> </BNavCont>
) )
@ -109,7 +121,7 @@ const Menu = () => {
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
return ( return (
<> <>
<BNav show={open} /> <BNav show={open} onClick={() => setOpen(false)}/>
<BurgerContainer open={open} onClick={() => setOpen(!open)}> <BurgerContainer open={open} onClick={() => setOpen(!open)}>
<MenuLine /> <MenuLine />
<MenuLine /> <MenuLine />

Loading…
Cancel
Save