diff --git a/packages/berlin/public/icons/menu-dark.svg b/packages/berlin/public/icons/menu-dark.svg deleted file mode 100644 index fa989a68..00000000 --- a/packages/berlin/public/icons/menu-dark.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/packages/berlin/public/icons/menu-light.svg b/packages/berlin/public/icons/menu-light.svg deleted file mode 100644 index 93bf1518..00000000 --- a/packages/berlin/public/icons/menu-light.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/packages/berlin/src/components/header/Header.styled.tsx b/packages/berlin/src/components/header/Header.styled.tsx index d4d5d69f..a3d53a76 100644 --- a/packages/berlin/src/components/header/Header.styled.tsx +++ b/packages/berlin/src/components/header/Header.styled.tsx @@ -1,4 +1,4 @@ -import styled from 'styled-components'; +import styled, { keyframes } from 'styled-components'; import Button from '../button/Button'; export const SyledHeader = styled.header` @@ -78,25 +78,83 @@ export const NavButtons = styled.ul` list-style: none; `; -export const DesktopButtons = styled.ul` +export const DesktopButtons = styled.div` display: none; @media (min-width: 1080px) { display: flex; gap: 1rem; - list-style: none; + } +`; + +export const MobileButtons = styled.div` + display: flex; + flex-direction: column; + gap: 1.5rem; + height: 100%; + @media (min-width: 1080px) { + display: none; } `; export const ThemeButton = styled(Button)``; -export const MenuButton = styled.button` - display: block; - background-color: var(--color-white); - border: none; +export const MenuButton = styled.div` + align-items: center; + cursor: pointer; + display: flex; + flex-direction: column; height: 2.25rem; + justify-content: center; width: 2.25rem; @media (min-width: 1080px) { display: none; } `; + +export const Bar = styled.div<{ isOpen: boolean }>` + background-color: var(--color-black); + border-radius: 8px; + height: 3px; + margin: 2px 0; + transition: 0.4s; + width: 27px; + + &:first-child { + transform: ${({ isOpen }) => (isOpen ? 'rotate(-45deg) translateY(10px)' : '')}; + } + + &:nth-child(2) { + opacity: ${({ isOpen }) => (isOpen ? '0' : '1')}; + transition: 0.2s; + } + + &:nth-child(3) { + transform: ${({ isOpen }) => (isOpen ? 'rotate(45deg) translateY(-10px)' : '')}; + } +`; + +const fadeIn = keyframes` + from { + opacity: 0; + } + to { + opacity: 1; + } +`; + +export const BurgerMenuContainer = styled.nav<{ $isOpen: boolean }>` + align-items: center; + background-color: var(--color-white); + bottom: 0; + display: flex; + height: calc(100% - 160px); + justify-content: center; + left: 0; + position: fixed; + width: 100%; + z-index: 999; + + display: ${(props) => (props.$isOpen ? 'flex' : 'none')}; + animation: ${fadeIn} 0.3s ease-out; +`; diff --git a/packages/berlin/src/components/header/Header.tsx b/packages/berlin/src/components/header/Header.tsx index 58a58e00..d6a3f64c 100644 --- a/packages/berlin/src/components/header/Header.tsx +++ b/packages/berlin/src/components/header/Header.tsx @@ -1,4 +1,5 @@ // React and third-party libraries +import { useState } from 'react'; import { useMutation, useQueryClient } from '@tanstack/react-query'; import { useNavigate } from 'react-router-dom'; @@ -18,6 +19,8 @@ import ZupassLoginButton from '../zupassButton/ZupassLoginButton'; // Styled components import { + Bar, + BurgerMenuContainer, DesktopButtons, HeaderContainer, LogoContainer, @@ -25,6 +28,7 @@ import { LogoSubtext, LogoText, MenuButton, + MobileButtons, NavButtons, NavContainer, SyledHeader, @@ -47,6 +51,8 @@ function Header() { }, }); + const [isBurgerMenuOpen, setIsBurgerMenuOpen] = useState(false); + return ( @@ -68,20 +74,38 @@ function Header() { Account - + ) : ( Login with Zupass )} - - + setIsBurgerMenuOpen(!isBurgerMenuOpen)}> + + + + setIsBurgerMenuOpen(false)}> + + + {user ? ( + <> + + Account + + + + ) : ( + Login with Zupass + )} + + + );