Files
qna-viewer-react/viewer/src/components/Header.js

31 lines
1.7 KiB
JavaScript

import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { NavLink } from "react-router-dom";
import { ProjectSelectBox } from "./ProjectSelectBox";
import { Separator } from "./ui/separator";
import { ThemeSelectBox } from "./ThemeSelectBox";
import { LanguageSelectBox } from "./LanguageSelectBox";
import { UserProfileBox } from "./UserProfileBox";
import { useSettingsStore } from "@/store/useSettingsStore";
const menuItems = [
{ name: "Home", path: "/" },
{ name: "Feedback", path: "/feedbacks" },
{ name: "Issue", path: "/issues" },
];
export function Header() {
const projectId = useSettingsStore((state) => state.projectId);
const channelId = useSettingsStore((state) => state.channelId);
const getFullPath = (path) => {
if (path === "/")
return `/`; // Landing 페이지 경로 예시
if (path.startsWith("/feedbacks")) {
return `/projects/${projectId}/channels/${channelId}${path}`;
}
if (path.startsWith("/issues")){
return `/projects/${projectId}${path}`;
}
return path;
};
return (_jsxs("header", { className: "flex h-16 items-center border-b px-4", children: [_jsx(ProjectSelectBox, { className: "mr-4"}), _jsx("nav", { className: "flex items-center space-x-4 lg:space-x-6 flex-1 ml-8", children: menuItems.map((item) => (_jsx(NavLink, { to: getFullPath(item.path), className: ({ isActive }) => `text-sm font-medium transition-colors hover:text-primary ${!isActive ? "text-muted-foreground" : ""}`, children: item.name }, item.name))) }), _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(ThemeSelectBox, {}), _jsx(LanguageSelectBox, {}), _jsx(UserProfileBox, {})] })] }));
}