From 090a0a041acb2be7aa26136175b5adf96d426be0 Mon Sep 17 00:00:00 2001 From: Minjee Son <104430030+iammminzzy@users.noreply.github.com> Date: Tue, 10 Sep 2024 13:32:13 +0100 Subject: [PATCH] Add categories menu --- app/error.tsx | 3 +- app/page.tsx | 4 +- components/layout/navbar/index.tsx | 95 ++++++++++++++++++++++++++---- tailwind.config.js | 3 +- 4 files changed, 88 insertions(+), 17 deletions(-) diff --git a/app/error.tsx b/app/error.tsx index f36ec80d7..7a95af8a7 100644 --- a/app/error.tsx +++ b/app/error.tsx @@ -5,9 +5,8 @@ import { useRouter } from 'next/navigation'; export default function Error({ resetAction }: { resetAction?: () => void }) { const router = useRouter(); - // '/'로 이동하는 defaultReset 함수 const defaultReset = () => { - router.push('/'); // 메인 페이지로 이동 + router.push('/'); }; return ( diff --git a/app/page.tsx b/app/page.tsx index 1de1ed24c..8f98f80c2 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -24,7 +24,7 @@ export default async function HomePage() { <>
-
+

{products[0].title}

Read more -
+
diff --git a/components/layout/navbar/index.tsx b/components/layout/navbar/index.tsx index 20ebc0bd4..34ff5ba00 100644 --- a/components/layout/navbar/index.tsx +++ b/components/layout/navbar/index.tsx @@ -1,5 +1,4 @@ -import Link from 'next/link'; -import { Suspense } from 'react'; +'use client'; import { Bars3Icon, @@ -8,23 +7,37 @@ import { UserIcon } from '@heroicons/react/24/outline'; import Logo from 'components/icons/logo'; -import { SearchSkeleton } from './search'; +import { LiHTMLAttributes, useState } from 'react'; + +interface MenuListItemProps extends LiHTMLAttributes { + type: 'main' | 'sub'; +} + +function MenuListItem({ type, children }: MenuListItemProps) { + return ( + <> + {type === 'main' ? ( +
  • {children}
  • + ) : ( +
  • {children}
  • + )} + + ); +} + +export function Navbar() { + const [isMenuOpen, setIsMenuOpen] = useState(false); -export async function Navbar() { return ( ); } diff --git a/tailwind.config.js b/tailwind.config.js index dfb6495a7..d3581ac1f 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -10,7 +10,8 @@ module.exports = { }, colors: { lightText: '#FFF2DB', - mainBG: '#F8E8D1' + mainBG: '#F8E8D1', + menuHover: '#C6BAA7' }, keyframes: { fadeIn: {