diff --git a/src/components/GNB/GNB.tsx b/src/components/GNB/GNB.tsx index 749c6cf2..255cc59d 100644 --- a/src/components/GNB/GNB.tsx +++ b/src/components/GNB/GNB.tsx @@ -1,12 +1,14 @@ +import { useState } from 'react'; import Image from 'next/image'; import Link from 'next/link'; import { useRouter } from 'next/router'; import { css, Theme } from '@emotion/react'; +import { AnimatePresence } from 'framer-motion'; import { Button } from '~/components/Button'; -import { MenuIcon } from '~/components/Icons'; +import { MobileMenu } from '~/components/GNB/MobileMenu'; +import { MobileMenuIcon } from '~/components/GNB/MobileMenuIcon'; import { GNB_MENU_NAME, GNBMenu } from '~/constant/gnb'; -import { colors } from '~/styles/colors'; import { mediaQuery } from '~/styles/media'; const LOGO_IMAGE = `/images/logo.png`; @@ -23,12 +25,14 @@ function ApplyButton({ menu }: { menu: GNBMenu }) { export function GNB() { const { pathname } = useRouter(); + const [isMenuOpen, setIsMenuOpen] = useState(false); const getActiveLinkcss = (menu: GNBMenu) => { if (pathname.startsWith(menu.href)) { return activeLinkCss; } return inActiveLinkCss; }; + return ( <> +
> ); } -const navCss = css` - background-color: ${colors.black800}; +const navCommonCss = (theme: Theme) => css` + background-color: ${theme.colors.black800}; position: fixed; - padding: 20px 32px; top: 0; left: 0; z-index: 9998; width: 100vw; `; +const navCss = (theme: Theme) => css` + ${navCommonCss(theme)}; + padding: 20px 32px; + + ${mediaQuery('mobile')} { + display: none; + } +`; + const blankCss = css` width: 100vw; height: 82px; + + ${mediaQuery('mobile')} { + height: 72px; + } `; const navWrapperCss = css` @@ -85,13 +107,9 @@ const navWrapperCss = css` const menuContainerCss = css` display: flex; gap: 32px; - - ${mediaQuery('mobile')} { - display: none; - } `; -const mobileMenuContainerCss = css` +const mobileNavCss = css` display: none; ${mediaQuery('mobile')} { @@ -114,3 +132,15 @@ const inActiveLinkCss = (theme: Theme) => css` const linkCss = (theme: Theme) => css` ${theme.typos.pretendard.body1}; `; + +const mobileMenuGNBCss = (theme: Theme) => css` + ${navCommonCss(theme)}; + padding: 20px 32px; + display: flex; + align-items: center; + justify-content: space-between; + + & > a { + margin-top: 6px; + } +`; diff --git a/src/components/GNB/MobileMenu.tsx b/src/components/GNB/MobileMenu.tsx new file mode 100644 index 00000000..e217c691 --- /dev/null +++ b/src/components/GNB/MobileMenu.tsx @@ -0,0 +1,62 @@ +import Link from 'next/link'; +import { css, Theme } from '@emotion/react'; +import { m } from 'framer-motion'; + +import { GNB_MENU_NAME } from '~/constant/gnb'; + +export function MobileMenu({}) { + return ( +