import { Fragment } from "react"; import { Disclosure, Menu, Transition } from "@headlessui/react"; import Link from "next/link"; import { useRouter } from "next/router"; import { signOut } from "next-auth/react"; import { Bars3Icon, BellIcon, MagnifyingGlassIcon, XMarkIcon, } from "@heroicons/react/24/outline"; import Logo from "./logo"; const user = { name: "Timur Ercan", email: "timur@documenso.com", imageUrl: "https://pbs.twimg.com/profile_images/1382036502390181888/4BT30oTM_400x400.jpg", }; const navigation = [ { name: "Dashboard", href: "/dashboard", current: true }, { name: "Documents", href: "/documents", current: false }, { name: "Settings", href: "/settings" }, ]; const userNavigation = [ { name: "Your Profile", href: "/settings" }, { name: "Sign out", href: "/login", click: (e: any) => { e.preventDefault(); signOut(); }, }, ]; function classNames(...classes: any) { return classes.filter(Boolean).join(" "); } export default function Layout({ children }: any) { const router = useRouter(); navigation.forEach((element) => { element.current = element.href == router.route; }); return ( <>
{({ open }) => ( <>
{navigation.map((item) => ( {item.name} ))}
{/* Search section */}
{/* Profile dropdown */}
Open user menu
{userNavigation.map((item) => ( {({ active }) => ( {item.name} )} ))}
{/* Mobile menu button */} Open main menu {open ? (
{navigation.map((item) => ( {item.name} ))}
{user.name}
{user.email}
{userNavigation.map((item) => ( {item.name} ))}
)}
{children}
); }