mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-30 12:55:02 +00:00
Added navbar dependent on path
This commit is contained in:
parent
ee521d17b7
commit
608c9b82ab
3 changed files with 11 additions and 5 deletions
|
|
@ -1,9 +1,10 @@
|
|||
"use client";
|
||||
|
||||
import React, { useState } from "react";
|
||||
import React, { use, useState } from "react";
|
||||
import { Transition } from "@headlessui/react";
|
||||
import ProfileDropDown from "./ProfileDropDown";
|
||||
import { signOut } from "next-auth/react";
|
||||
import { usePathname } from "next/navigation";
|
||||
|
||||
function makeLink(href: string, label: string) {
|
||||
return (
|
||||
|
|
@ -16,7 +17,13 @@ function makeLink(href: string, label: string) {
|
|||
);
|
||||
}
|
||||
|
||||
function Nav({ pageName }: { pageName: string }) {
|
||||
function Nav() {
|
||||
const pathname = usePathname();
|
||||
|
||||
if (pathname === "/") {
|
||||
return null;
|
||||
}
|
||||
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
return (
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ function ProfileDropDown() {
|
|||
</span>
|
||||
)}
|
||||
</Menu.Button>
|
||||
<Menu.Items className="absolute right-0 mt-2 w-48 origin-top-right overflow-hidden rounded-md border bg-white shadow-lg focus:outline-none">
|
||||
<Menu.Items className="z-[100] absolute right-0 mt-2 w-48 origin-top-right overflow-hidden rounded-md border bg-white shadow-lg focus:outline-none">
|
||||
<Menu.Item>
|
||||
<Link href="/help" className="flex px-4 py-2 text-sm text-gray-700">
|
||||
Help
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import "./globals.css";
|
||||
import Provider from "./components/Provider";
|
||||
import Nav from "./components/Navbar";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { ReactQueryProvider } from "./ReactQueryProvider";
|
||||
|
||||
export const metadata = {
|
||||
|
|
@ -23,7 +22,7 @@ export default function RootLayout({
|
|||
<body>
|
||||
<Provider>
|
||||
<ReactQueryProvider>
|
||||
<Nav pageName="Home"></Nav>
|
||||
<Nav />
|
||||
{children}
|
||||
</ReactQueryProvider>
|
||||
</Provider>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue