251121_01_ENH : 로그인 및 인증 저장, api통신 시 자동으로 accessKey 붙게 조치
This commit is contained in:
120
src/components/layout/Header.tsx
Normal file
120
src/components/layout/Header.tsx
Normal file
@@ -0,0 +1,120 @@
|
||||
"use client";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Menu, X, ZoomIn, ZoomOut, LogOut } from "lucide-react";
|
||||
import Image from "next/image";
|
||||
import { topMenus } from "@/config/menu.data";
|
||||
|
||||
interface HeaderProps {
|
||||
isMain: boolean;
|
||||
menuOpen: boolean;
|
||||
activeTopId: string;
|
||||
fontSize: number;
|
||||
handleIsProjectMenu: (isProjectMenu: boolean) => void;
|
||||
onToggleMenu: () => void;
|
||||
onNavigate: (path: string) => void;
|
||||
decreaseFontSize: () => void;
|
||||
increaseFontSize: () => void;
|
||||
}
|
||||
|
||||
export const Header = ({
|
||||
isMain,
|
||||
menuOpen,
|
||||
activeTopId,
|
||||
fontSize,
|
||||
handleIsProjectMenu,
|
||||
onToggleMenu,
|
||||
onNavigate,
|
||||
decreaseFontSize,
|
||||
increaseFontSize,
|
||||
}: HeaderProps) => {
|
||||
return (
|
||||
<header className="bg-white border-b border-gray-200 sticky top-0 z-40">
|
||||
<div className="flex items-center justify-between px-4 h-16">
|
||||
<div className="flex items-center gap-4">
|
||||
{/* 햄버거 메뉴 */}
|
||||
<div className="w-5">
|
||||
{isMain? null :
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="cursor-pointer"
|
||||
onClick={() => onToggleMenu()}
|
||||
>
|
||||
{menuOpen ? <X className="w-5 h-5" /> : <Menu className="w-5 h-5" />}
|
||||
</Button>
|
||||
}
|
||||
</div>
|
||||
{/* 로고 */}
|
||||
<div
|
||||
className="flex items-center gap-2 cursor-pointer"
|
||||
onClick={() => onNavigate("/")}
|
||||
>
|
||||
<div className="w-20 h-10 flex items-center justify-center">
|
||||
<Image
|
||||
src="/kri_logo.png"
|
||||
alt="KRI 로고"
|
||||
width={120}
|
||||
height={40}
|
||||
className="object-contain"
|
||||
priority
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 상단 메뉴 */}
|
||||
<nav className="flex items-center gap-1 ml-25">
|
||||
{topMenus.map((m) => (
|
||||
<Button
|
||||
key={m.id}
|
||||
variant={activeTopId === m.id ? "default" : "ghost"}
|
||||
className="cursor-pointer"
|
||||
onClick={() => {
|
||||
handleIsProjectMenu(m.id === "project");
|
||||
onNavigate(m.path);
|
||||
}}
|
||||
>
|
||||
{m.label}
|
||||
</Button>
|
||||
))}
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
{/* 우측 컨트롤 */}
|
||||
<div className="flex items-center gap-4">
|
||||
<div className="flex items-center gap-1 border-r pr-4">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onClick={() => decreaseFontSize()}
|
||||
title="폰트 작게"
|
||||
>
|
||||
<ZoomOut className="w-4 h-4" />
|
||||
</Button>
|
||||
<span className="text-xs text-gray-500 min-w-[3rem] text-center">
|
||||
{fontSize}px
|
||||
</span>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onClick={() => increaseFontSize()}
|
||||
title="폰트 크게"
|
||||
>
|
||||
<ZoomIn className="w-4 h-4" />
|
||||
</Button>
|
||||
</div>
|
||||
<span className="text-sm text-gray-600 hidden sm:inline">admin</span>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="gap-2"
|
||||
onClick={() => onNavigate("/logout")}
|
||||
>
|
||||
<LogOut className="w-4 h-4" />
|
||||
<span className="hidden sm:inline">로그아웃</span>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user