From b52db4196506cfbb1360d26574e4c8c8bb97e20e Mon Sep 17 00:00:00 2001 From: Yangshun Tay Date: Tue, 11 Oct 2022 17:46:21 +0800 Subject: [PATCH] [portal][ui] improve product navbar --- .../portal/src/components/global/AppShell.tsx | 2 ++ .../src/components/global/HomeNavigation.ts | 1 + .../components/global/ProductNavigation.tsx | 29 +++++++++++++------ .../src/components/offers/OffersNavigation.ts | 1 + .../questions/QuestionBankTitle.tsx | 5 ---- .../questions/QuestionsNavigation.ts | 2 +- .../components/resumes/ResumesNavigation.ts | 2 ++ 7 files changed, 27 insertions(+), 15 deletions(-) delete mode 100644 apps/portal/src/components/questions/QuestionBankTitle.tsx diff --git a/apps/portal/src/components/global/AppShell.tsx b/apps/portal/src/components/global/AppShell.tsx index 0275dbb5..bcb9af67 100644 --- a/apps/portal/src/components/global/AppShell.tsx +++ b/apps/portal/src/components/global/AppShell.tsx @@ -109,6 +109,7 @@ export default function AppShell({ children }: Props) { navigation: ProductNavigationItems; showGlobalNav: boolean; title: string; + titleHref: string; }> = (() => { const path = router.pathname; if (path.startsWith('/resumes')) { @@ -190,6 +191,7 @@ export default function AppShell({ children }: Props) {
diff --git a/apps/portal/src/components/global/HomeNavigation.ts b/apps/portal/src/components/global/HomeNavigation.ts index 073a7b36..eb41d372 100644 --- a/apps/portal/src/components/global/HomeNavigation.ts +++ b/apps/portal/src/components/global/HomeNavigation.ts @@ -17,6 +17,7 @@ const config = { navigation, showGlobalNav: true, title: 'Tech Interview Handbook', + titleHref: '/', }; export default config; diff --git a/apps/portal/src/components/global/ProductNavigation.tsx b/apps/portal/src/components/global/ProductNavigation.tsx index caae6c08..43670585 100644 --- a/apps/portal/src/components/global/ProductNavigation.tsx +++ b/apps/portal/src/components/global/ProductNavigation.tsx @@ -1,5 +1,6 @@ import clsx from 'clsx'; import Link from 'next/link'; +import { useRouter } from 'next/router'; import { Fragment } from 'react'; import { Menu, Transition } from '@headlessui/react'; import { ChevronDownIcon } from '@heroicons/react/20/solid'; @@ -8,6 +9,7 @@ type NavigationItem = Readonly<{ children?: ReadonlyArray; href: string; name: string; + target?: '_blank'; }>; export type ProductNavigationItems = ReadonlyArray; @@ -15,15 +17,21 @@ export type ProductNavigationItems = ReadonlyArray; type Props = Readonly<{ items: ProductNavigationItems; title: string; + titleHref: string; }>; -export default function ProductNavigation({ items, title }: Props) { +export default function ProductNavigation({ items, title, titleHref }: Props) { + const router = useRouter(); + return ( -