-
I found out that on Gatsbyjs v2, the Is there a way to prevent home page menu button being highlighted while we're on different page? Here is my import { Link } from "gatsby"
import React from "react"
import { rhythm } from '../utils/typography';
const Header = ({ menuLinks }) => (
<header itemScope itemType="http://schema.org/Menu">
<div>
<nav>
<ul style = {{
display: `flex`,
flex: `1`,
margin: `0`,
padding: `0`
}}
>
{menuLinks.map(link => (
<li
key={link.name}
style = {{
marginRight: rhythm(0.4),
listStyleType: `none`,
}}
>
<Link
to = { link.link }
itemProp="url"
getProps={({isPartiallyCurrent}) => ({
style: { color : isPartiallyCurrent ? `#fff1d0` : `grey`},
})}
className="link"
>
{link.name}
</Link>
</li>
))}
</ul>
</nav>
</div>
</header>
)
export default Header |
Beta Was this translation helpful? Give feedback.
Answered by
joperron
Feb 16, 2021
Replies: 1 comment 1 reply
-
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
bsraya
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
/
should useisCurrent
notisPartiallyCurrent
since every page is under/
it will always be true