Skip to content

Commit

Permalink
fix(docs): Update custom Link component by adding partiallyActive (#…
Browse files Browse the repository at this point in the history
…13360)

* fix(docs): Update custom Link component by adding `partiallyActive` option

Updated Custom Link component in gatsby-link page by adding `partiallyActive` option.

* Update gatsby-link.md

* chore: format


Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
  • Loading branch information
2 people authored and LekoArts committed Apr 15, 2019
1 parent 2918bf7 commit c090db3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions docs/docs/gatsby-link.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,10 @@ following may be a good starting point:
```jsx
import { Link as GatsbyLink } from "gatsby"
// Since DOM elements <a> cannot receive activeClassName,
// destructure the prop here and pass it only to GatsbyLink
const Link = ({ children, to, activeClassName, ...other }) => {
// Since DOM elements <a> cannot receive activeClassName
// and partiallyActive, destructure the prop here and
// pass it only to GatsbyLink
const Link = ({ children, to, activeClassName, partiallyActive, ...other }) => {
// Tailor the following test to your environment.
// This example assumes that any internal link (intended for Gatsby)
// will start with exactly one slash, and that anything else is external.
Expand All @@ -309,7 +310,12 @@ const Link = ({ children, to, activeClassName, ...other }) => {
// Use Gatsby Link for internal links, and <a> for others
if (internal) {
return (
<GatsbyLink to={to} activeClassName={activeClassName} {...other}>
<GatsbyLink
to={to}
activeClassName={activeClassName}
partiallyActive={partiallyActive}
{...other}
>
{children}
</GatsbyLink>
)
Expand Down

0 comments on commit c090db3

Please sign in to comment.