Skip to content
Permalink
Browse files

fix: 🐛 show blog tab as active on blog post pages

  • Loading branch information
kitos committed Oct 16, 2019
1 parent e4662b2 commit 3ab35330505946c676593d9452df79ec833cee4a
Showing with 8 additions and 5 deletions.
  1. +8 −5 src/components/navigation.js
@@ -29,11 +29,14 @@ let NavLink = ({ to, className, ...props }) => (
<Link
to={to}
className={className}
getProps={({ isCurrent, isPartiallyCurrent }) =>
isCurrent || (to !== '/' && isPartiallyCurrent)
? { className: `${className} active` }
: null
}
getProps={({ isCurrent, isPartiallyCurrent, href, location }) => {
let isReallyCurrent =
isCurrent ||
(to !== '/' && isPartiallyCurrent) ||
(href.includes('blog') && location.pathname.includes('blog'))

return isReallyCurrent ? { className: `${className} active` } : null
}}
{...props}
/>
)

0 comments on commit 3ab3533

Please sign in to comment.
You can’t perform that action at this time.