From 1a784a99840e36a2d4bd7b44a35649703a4bc4fe Mon Sep 17 00:00:00 2001 From: Dora Su Date: Wed, 26 May 2021 16:13:54 +0000 Subject: [PATCH] Add new routes to the navbar --- components/Navbar.tsx | 53 +++++++++++++++++++++++++++------- pages/resources.mdx | 1 - pages/resources/services.mdx | 1 + pages/resources/tech-talks.mdx | 1 + 4 files changed, 44 insertions(+), 12 deletions(-) delete mode 100644 pages/resources.mdx create mode 100644 pages/resources/services.mdx create mode 100644 pages/resources/tech-talks.mdx diff --git a/components/Navbar.tsx b/components/Navbar.tsx index 1111c7a6..5bf8d8c4 100644 --- a/components/Navbar.tsx +++ b/components/Navbar.tsx @@ -50,24 +50,35 @@ const menu: NavLink[] = [ }, { name: "Resources", - route: "/resources", + route: "/resources/services", + submenu: [ + { + name: "Services", + route: "/resources/services", + }, + { + name: "Tech Talks", + route: "/resources/tech-talks", + }, + { + name: "CS Club Wiki", + route: "https://wiki.csclub.uwaterloo.ca/", + }, + ], }, ]; function NavItem(props: NavLink) { const router = useRouter(); + const externalLink = + props.route.includes("http://") || props.route.includes("https://"); return ( <> - + {externalLink ? ( 0 && - router.pathname.startsWith(props.route)) - ? styles.currentPage - : "" - } + href={props.route} + target="_blank" + rel="noopener noreferrer" onClick={() => { if (document.activeElement instanceof HTMLElement) { document.activeElement.blur(); @@ -76,7 +87,27 @@ function NavItem(props: NavLink) { > {props.name} - + ) : ( + + 0 && + router.pathname.startsWith(props.route)) + ? styles.currentPage + : "" + } + onClick={() => { + if (document.activeElement instanceof HTMLElement) { + document.activeElement.blur(); + } + }} + > + {props.name} + + + )} {(props.submenu?.length ?? 0) > 0 ? (