diff --git a/client/src/components/Button/index.tsx b/client/src/components/Button/index.tsx index 739b3b2..2856d5e 100644 --- a/client/src/components/Button/index.tsx +++ b/client/src/components/Button/index.tsx @@ -27,7 +27,9 @@ const Button = ({ disabled, }: IButton) => { const className = variation[color]; - const linkProps = openInNewTab ? { target: "_blank", rel: "noopener noreferrer" } : {}; + const linkProps = openInNewTab + ? { target: "_blank", rel: "noopener noreferrer" } + : { onClick }; return to ? ( diff --git a/client/src/components/LayoutEvaluation/index.tsx b/client/src/components/LayoutEvaluation/index.tsx index 19b9a06..292fa85 100644 --- a/client/src/components/LayoutEvaluation/index.tsx +++ b/client/src/components/LayoutEvaluation/index.tsx @@ -2,10 +2,11 @@ import React from "react"; import { Outlet } from "react-router-dom"; import NavbarEvaluation from "../NavbarEvaluation"; import Footer from "../Footer"; +import { Menu } from "../Navbar"; const LayoutEvaluation = () => ( <> - + } />
diff --git a/client/src/components/Navbar/index.tsx b/client/src/components/Navbar/index.tsx index d92f368..a9c8778 100644 --- a/client/src/components/Navbar/index.tsx +++ b/client/src/components/Navbar/index.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { Fragment } from "react"; import { NavLink } from "react-router-dom"; import NavbarEvaluation from "@/components/NavbarEvaluation"; import Button from "@/components/Button"; @@ -6,6 +6,8 @@ import UserMenu from "@/components/UserMenu"; import { useAppSelector } from "@/redux/store"; import logo from "@/assets/platforma_FDSC_Kaufland.svg"; import getUserType from "@/lib/userType"; +import { Bars3Icon } from "@heroicons/react/20/solid"; +import { Menu as MenuHeadless, Transition } from "@headlessui/react"; const MENU = { public: [ @@ -120,37 +122,92 @@ const MENU = { ], }; -const Menu = () => { +export const Menu = () => { const user = useAppSelector((state) => state.userState.user); const userType = getUserType(user); - console.log("userType", userType); const menu = MENU[userType]; - const linkClassName = - "flex flex-wrap border-b-2 border-transparent px-3 py-2 font-medium items-center text-gray-900 border-teal-600"; - return ( - + <> + + + + + + + + {menu.map((menuItem) => ( + + + `flex flex-wrap border-b-2 border-transparent px-3 py-2 font-medium items-center text-gray-900 border-teal-600 ${ + isPending ? "bg-gray-50" : isActive ? "bg-gray-100" : "" + }` + } + > + {menuItem.text} + + + ))} + {!user && ( + <> + + {({ close }) => ( + + )} + + + {({ close }) => ( + + )} + + + )} + + + + ); }; @@ -164,13 +221,13 @@ const Example = () => { {user ? ( ) : ( -
+
-
+
diff --git a/client/src/components/NavbarEvaluation/index.tsx b/client/src/components/NavbarEvaluation/index.tsx index b8b4c5a..ef836ca 100644 --- a/client/src/components/NavbarEvaluation/index.tsx +++ b/client/src/components/NavbarEvaluation/index.tsx @@ -10,8 +10,8 @@ const NavbarEvaluation = ({ menu?: ReactNode; }) => (
-