From d5243f5f133f4df949f0da25423f7e32cb02a51b Mon Sep 17 00:00:00 2001 From: Nazareno Oviedo Date: Wed, 20 Apr 2022 13:06:43 -0300 Subject: [PATCH] feat: blog improves --- src/components/common/header/index.tsx | 18 +++++++++++++++-- .../sections/blog/post-hero/index.tsx | 2 +- src/pages/about.tsx | 2 +- src/pages/blog/[slug].tsx | 20 ++++++------------- src/pages/blog/index.tsx | 2 +- src/pages/index.tsx | 2 +- src/pages/products.tsx | 4 +--- 7 files changed, 27 insertions(+), 23 deletions(-) diff --git a/src/components/common/header/index.tsx b/src/components/common/header/index.tsx index 9b9a5bf..467e7cf 100644 --- a/src/components/common/header/index.tsx +++ b/src/components/common/header/index.tsx @@ -21,7 +21,14 @@ const HeaderMobile = React.forwardRef< >(({ className, ...props }, ref) => { const router = useRouter() - const isActive = (href: string) => router.pathname === href + const isActive = (href: string) => { + const slug = router.query.slug as string + if (slug) { + return router.pathname.replace('/[slug]', '') === href + } else { + return router.pathname === href + } + } return (