From 608c9b82ab9d052b3003521c48d57ae7b47b4a8c Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Wed, 31 May 2023 20:38:23 +0100 Subject: [PATCH] Added navbar dependent on path --- src/app/components/Navbar.tsx | 11 +++++++++-- src/app/components/ProfileDropDown.tsx | 2 +- src/app/layout.tsx | 3 +-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/app/components/Navbar.tsx b/src/app/components/Navbar.tsx index ce4c0bd1..fc22c9d4 100644 --- a/src/app/components/Navbar.tsx +++ b/src/app/components/Navbar.tsx @@ -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 (
diff --git a/src/app/components/ProfileDropDown.tsx b/src/app/components/ProfileDropDown.tsx index 78a3b5f6..645b3313 100644 --- a/src/app/components/ProfileDropDown.tsx +++ b/src/app/components/ProfileDropDown.tsx @@ -32,7 +32,7 @@ function ProfileDropDown() { )} - + Help diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 2b3a3685..a3627629 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -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({ - +