From 8481ab1044601252d26f41dfa19ba6bc8a65810a Mon Sep 17 00:00:00 2001 From: Yangshun Tay Date: Sun, 9 Oct 2022 11:08:57 +0800 Subject: [PATCH] [portal][ui] change app shell UI --- apps/portal/public/favicon.ico | Bin 9662 -> 9797 bytes .../portal/src/components/global/AppShell.tsx | 90 +++++++++++++----- .../src/components/global/HomeNavigation.ts | 21 ++++ .../components/global/ProductNavigation.tsx | 72 ++++++++++++++ .../src/components/offers/OffersNavigation.ts | 22 +++++ .../src/components/questions/NavBar.tsx | 56 ----------- .../questions/QuestionsNavigation.ts | 15 +++ .../components/resumes/ResumesNavigation.ts | 22 +++++ apps/portal/src/pages/index.tsx | 4 - apps/portal/src/pages/questions/index.tsx | 6 +- 10 files changed, 218 insertions(+), 90 deletions(-) create mode 100644 apps/portal/src/components/global/HomeNavigation.ts create mode 100644 apps/portal/src/components/global/ProductNavigation.tsx create mode 100644 apps/portal/src/components/offers/OffersNavigation.ts delete mode 100644 apps/portal/src/components/questions/NavBar.tsx create mode 100644 apps/portal/src/components/questions/QuestionsNavigation.ts create mode 100644 apps/portal/src/components/resumes/ResumesNavigation.ts diff --git a/apps/portal/public/favicon.ico b/apps/portal/public/favicon.ico index d3b456c0702274473e7d64cca7f8815d089677c2..2b50a78284f6df84d92268e4a3948a2a7acdf04c 100644 GIT binary patch literal 9797 zcmaiaXH-)`*KX*M4pIf_Do6=Ms&r65rAjXbK|n-`AW{Spnsh;`6bVR=0)ljq&^v-C zqO{PF9;5{bIrrfEuKVMz_1$l+5|tS5iyEg;*KHzs3CCKgkD`| zkja}W_2Q_J(pz8jjjx0v@sGM)^c-Y28P@dYw{2ojKMyw>HrIES3K0{&e!R^UYFkam zPQGS#6BEwkI|T*D)pY8_)elyeBx~lR-E{@WV$qwL>DQjUs0*@*`dul3&en&~s%J^n zII4-44czamHtX&6+i@En`Ow_^fE-ywmz@LRYIrG?ZR@X0+dS9IapGz#1mbF(Rg>Zw>gKEV ze1?!g!_blkl^82V6B5O^vJF;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QL_|ChPvHC_LYGmACN zuluadq!UwnEd7}7J|<36dn|r@o^4|CX^+8Q#JyS$lZ?AJBgv HrvkqLky{gH diff --git a/apps/portal/src/components/global/AppShell.tsx b/apps/portal/src/components/global/AppShell.tsx index fde9d3b6..c94c1f58 100644 --- a/apps/portal/src/components/global/AppShell.tsx +++ b/apps/portal/src/components/global/AppShell.tsx @@ -1,5 +1,6 @@ import clsx from 'clsx'; import Link from 'next/link'; +import { useRouter } from 'next/router'; import { signIn, signOut, useSession } from 'next-auth/react'; import type { ReactNode } from 'react'; import { Fragment, useState } from 'react'; @@ -13,6 +14,14 @@ import { XMarkIcon, } from '@heroicons/react/24/outline'; +import HomeNavigation from '~/components/global/HomeNavigation'; +import OffersNavigation from '~/components/offers/OffersNavigation'; +import QuestionsNavigation from '~/components/questions/QuestionsNavigation'; +import ResumesNavigation from '~/components/resumes/ResumesNavigation'; + +import type { ProductNavigationItems } from './ProductNavigation'; +import ProductNavigation from './ProductNavigation'; + const sidebarNavigation = [ { current: false, href: '/', icon: HomeIcon, name: 'Home' }, { current: false, href: '/resumes', icon: DocumentTextIcon, name: 'Resumes' }, @@ -39,14 +48,15 @@ function ProfileJewel() { if (session == null) { return ( - { event.preventDefault(); signIn(); }}> Sign in - + ); } @@ -65,7 +75,7 @@ function ProfileJewel() { return (
- + Open user menu {session?.user?.image == null ? ( Render some icon @@ -110,18 +120,41 @@ function ProfileJewel() { export default function AppShell({ children }: Props) { const [mobileMenuOpen, setMobileMenuOpen] = useState(false); + const router = useRouter(); + + const currentProductNavigation: Readonly<{ + navigation: ProductNavigationItems; + title: string; + }> = (() => { + const path = router.pathname; + if (path.startsWith('/resumes')) { + return ResumesNavigation; + } + + if (path.startsWith('/offers')) { + return OffersNavigation; + } + + if (path.startsWith('/questions')) { + return QuestionsNavigation; + } + + return HomeNavigation; + })(); return (
{/* Narrow sidebar */} -
+
- Your Company + + Tech Interview Handbook +
{sidebarNavigation.map((item) => ( @@ -130,8 +163,8 @@ export default function AppShell({ children }: Props) { aria-current={item.current ? 'page' : undefined} className={clsx( item.current - ? 'bg-indigo-800 text-white' - : 'text-indigo-100 hover:bg-indigo-800 hover:text-white', + ? 'bg-primary-50 text-slate-700' + : 'text-slate-700 hover:bg-slate-200', 'group flex w-full flex-col items-center rounded-md p-3 text-xs font-medium', )} href={item.href}> @@ -139,8 +172,8 @@ export default function AppShell({ children }: Props) { aria-hidden="true" className={clsx( item.current - ? 'text-white' - : 'text-indigo-300 group-hover:text-white', + ? 'text-primary-500' + : 'text-slate-500 group-hover:text-slate-700', 'h-6 w-6', )} /> @@ -177,7 +210,7 @@ export default function AppShell({ children }: Props) { leave="transition ease-in-out duration-300 transform" leaveFrom="translate-x-0" leaveTo="-translate-x-full"> - +
- Your Company + + Tech Interview Handbook +