Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gatsby-link] Export NavLink explicitly from the package #2008

Closed
kripod opened this issue Sep 3, 2017 · 4 comments
Closed

[gatsby-link] Export NavLink explicitly from the package #2008

kripod opened this issue Sep 3, 2017 · 4 comments

Comments

@kripod
Copy link
Contributor

kripod commented Sep 3, 2017

Instead of automatically choosing an appropriate React Router link component based on the given props, I think that letting developers explicitly choose NavLink over Link should be a possibility.

That approach would make styling Glamorous components much easier compared to the current approach:

const CustomLink = glamorous(({ ...props }) => <Link exact {...props} />)({
  // CSS
});
@kripod kripod changed the title [gatsby-link] Export NavLink [gatsby-link] Export NavLink explicitly from the package Sep 3, 2017
@KyleAMathews
Copy link
Contributor

Let's consider this for v2

@jquense jquense mentioned this issue Dec 20, 2017
13 tasks
@nsimonson
Copy link
Contributor

Not really sure if it's better or worse for gatsby to have them split out, but FWIW you can set defaultProps on the glamorous component directly.

const CustomLink = glamorous(Link)({
  // CSS
  '.active': {
    // Active styles
  }
})

CustomLink.defaultProps = {
  exact: true
}

@KyleAMathews
Copy link
Contributor

Not relevant now that we've moved to @reach/router.

@bebyx
Copy link

bebyx commented Mar 15, 2020

@KyleAMathews There's a lack of support for Reach Router's <NavLink> though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants