diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-03-26 00:37:41 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-03-26 00:37:41 +0000 |
| commit | e0dfb55c5457aec489fc084c4567e791b4c65eb1 (patch) | |
| tree | 68543a65d88f5afb3a0202925804103daa91bc6f /components/layout/MobileMenu.tsx | |
3/25 까지의 대표님 작업사항
Diffstat (limited to 'components/layout/MobileMenu.tsx')
| -rw-r--r-- | components/layout/MobileMenu.tsx | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/components/layout/MobileMenu.tsx b/components/layout/MobileMenu.tsx new file mode 100644 index 00000000..d2e6b927 --- /dev/null +++ b/components/layout/MobileMenu.tsx @@ -0,0 +1,88 @@ +// components/MobileMenu.tsx + +"use client"; + +import * as React from "react"; +import Link from "next/link"; +import { useRouter,usePathname } from "next/navigation"; +import { MenuSection, mainNav, additionalNav, MenuItem, mainNavVendor, additionalNavVendor } from "@/config/menuConfig"; +import { cn } from "@/lib/utils"; +import { Drawer, DrawerContent,DrawerTitle,DrawerTrigger } from "@/components/ui/drawer"; +import { Button } from "@/components/ui/button"; + +interface MobileMenuProps { + lng: string; + onClose: () => void; +} + +export function MobileMenu({ lng, onClose }: MobileMenuProps) { + const router = useRouter(); + + + const handleLinkClick = (href: string) => { + router.push(href); + onClose(); + }; + const pathname = usePathname(); + const isPartnerRoute = pathname.includes("/partners"); + + const main = isPartnerRoute ? mainNavVendor : mainNav; + const additional = isPartnerRoute ? additionalNavVendor : additionalNav; + + return ( + <Drawer open={true} onOpenChange={onClose}> + <DrawerTrigger asChild> + </DrawerTrigger> + <DrawerTitle /> + <DrawerContent className="max-h-[60vh] p-0"> + <div className="overflow-auto p-6"> + + <nav> + <ul className="space-y-4"> + {/* 메인 네비게이션 섹션 */} + {main.map((section: MenuSection) => ( + <li key={section.title}> + <h3 className="text-md font-medium">{section.title}</h3> + <ul className="mt-2 space-y-2"> + {section.items.map((item: MenuItem) => ( + <li key={item.title}> + <Link + href={`/${lng}${item.href}`} + className="text-indigo-600" + onClick={() => handleLinkClick(item.href)} + > + {item.title} + {item.label && ( + <span className="ml-2 rounded-md bg-[#adfa1d] px-1.5 py-0.5 text-xs text-[#000000]"> + {item.label} + </span> + )} + </Link> + {item.description && ( + <p className="text-xs text-gray-500">{item.description}</p> + )} + </li> + ))} + </ul> + </li> + ))} + + {/* 추가 네비게이션 항목 */} + {additional.map((item: MenuItem) => ( + <li key={item.title}> + <Link + href={item.href} + className="block text-sm text-indigo-600" + onClick={() => handleLinkClick(`/${lng}${item.href}`)} + > + {item.title} + </Link> + </li> + ))} + </ul> + </nav> + </div> + </DrawerContent> + </Drawer> + ); +}
\ No newline at end of file |
