From 8a670419a0bdc443f290a0c7122df31f8205e5fa Mon Sep 17 00:00:00 2001 From: Peter Pan Date: Fri, 15 May 2020 11:59:41 +0800 Subject: [PATCH] fix: navbar actived link missing --- frontend/packages/core/components/Navbar.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/packages/core/components/Navbar.tsx b/frontend/packages/core/components/Navbar.tsx index 587173ff..6c578b5d 100644 --- a/frontend/packages/core/components/Navbar.tsx +++ b/frontend/packages/core/components/Navbar.tsx @@ -101,7 +101,9 @@ const changeLanguage = () => { const Navbar: FunctionComponent = () => { const {t, i18n} = useTranslation('common'); - const {pathname} = useRouter(); + const {pathname, basePath} = useRouter(); + + const path = useMemo(() => pathname.replace(basePath, ''), [pathname, basePath]); const indexUrl = useMemo(() => { // TODO: fix type @@ -125,7 +127,7 @@ const Navbar: FunctionComponent = () => { return ( // https://nextjs.org/docs/api-reference/next/link#if-the-child-is-a-custom-component-that-wraps-an-a-tag - + {t(name)} -- GitLab