From ff902243a658067fae858a615c0629aa2e0a4837 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Wed, 11 Jun 2025 12:18:38 +0000 Subject: (대표님) 20250611 21시 15분 OCR 등 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/layout/HeaderSimple.tsx | 192 +++++++++++++++++++++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 components/layout/HeaderSimple.tsx (limited to 'components/layout') diff --git a/components/layout/HeaderSimple.tsx b/components/layout/HeaderSimple.tsx new file mode 100644 index 00000000..f099d3ef --- /dev/null +++ b/components/layout/HeaderSimple.tsx @@ -0,0 +1,192 @@ +"use client"; + +import * as React from "react"; +import Link from "next/link"; +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuLabel, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; +import { + NavigationMenu, + NavigationMenuContent, + NavigationMenuItem, + NavigationMenuLink, + NavigationMenuList, + NavigationMenuTrigger, + navigationMenuTriggerStyle, +} from "@/components/ui/navigation-menu"; +import { SearchIcon, BellIcon, Menu } from "lucide-react"; +import { useParams, usePathname } from "next/navigation"; +import { cn } from "@/lib/utils"; +import Image from "next/image"; +import { mainNav, additionalNav, MenuSection, MenuItem, mainNavVendor, additionalNavVendor } from "@/config/menuConfig"; // 메뉴 구성 임포트 +import { MobileMenu } from "./MobileMenu"; +import { CommandMenu } from "./command-menu"; +import { useSession, signOut } from "next-auth/react"; +import GroupedMenuRenderer from "./GroupedMenuRender"; + +export function HeaderSimple() { + const params = useParams(); + const lng = params?.lng as string; + const pathname = usePathname(); + const { data: session } = useSession(); + + const userName = session?.user?.name || ""; + const domain = session?.user?.domain || ""; + const initials = userName + .split(" ") + .map((word) => word[0]?.toUpperCase()) + .join(""); + + + const [isMobileMenuOpen, setIsMobileMenuOpen] = React.useState(false); // 모바일 메뉴 상태 + + const toggleMobileMenu = () => { + setIsMobileMenuOpen(!isMobileMenuOpen); + }; + + const isPartnerRoute = pathname?.includes("/partners"); + + const main = isPartnerRoute ? mainNavVendor : mainNav; + const additional = isPartnerRoute ? additionalNavVendor : additionalNav; + + const basePath = `/${lng}${isPartnerRoute ? "/partners" : "/evcp"}`; + + return ( + <> + {/*
*/} +
+
+
+ {/* 햄버거 메뉴 버튼 (모바일) */} + + + {/* 로고 영역 - 항상 표시 */} +
+ + EVCP Logo + + {isPartnerRoute + ? "eVCP Partners" + : pathname?.includes("/evcp") + ? "eVCP 삼성중공업" + : "eVCP"} + + +
+ + {/* 네비게이션 메뉴 - 내부 스크롤 적용, 드롭다운은 제약 없이 표시 */} +
+ +
+ + {/* 우측 영역 - 고정 너비와 우선순위로 항상 표시되도록 함 */} +
+ {/* 데스크탑에서는 CommandMenu, 모바일에서는 검색 아이콘만 */} +
+ +
+ {/* */} + + {/* 알림 버튼 */} + {/* */} + + {/* 사용자 메뉴 (DropdownMenu) */} + + + + + + {initials || "?"} + + + + + My Account + + + Settings + + + signOut({ callbackUrl: `/${lng}/${domain}` })}> + Logout + + + +
+
+
+ + {/* 모바일 메뉴 */} + {isMobileMenuOpen && } +
+ + ); +} + +const ListItem = React.forwardRef< + React.ElementRef<"a">, + React.ComponentPropsWithoutRef<"a"> +>(({ className, title, children, ...props }, ref) => { + return ( +
  • + + +
    {title}
    + {children && ( +

    + {children} +

    + )} +
    +
    +
  • + ); +}); +ListItem.displayName = "ListItem"; \ No newline at end of file -- cgit v1.2.3