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

Show how active nav item would be specified and displayed with react router #94

Open
penx opened this issue Oct 11, 2018 · 6 comments
Open
Assignees

Comments

@penx
Copy link
Collaborator

penx commented Oct 11, 2018

Please support how an active nav item would be specified and displayed.

Possibly not a contender for context api as we'd probably expect something further up to be managing the routing and telling us what is active. But worth a thought.

Copied from
#93 (comment)

@Loque-
Copy link
Collaborator

Loque- commented Oct 11, 2018

I created an issue that I hope describes the problem and possible solutions reasonably well: remix-run/react-router#6390

@penx
Copy link
Collaborator Author

penx commented Oct 15, 2018

How do other component libraries handle this?

@Loque-
Copy link
Collaborator

Loque- commented Oct 15, 2018

Good question, my current answer is no idea - if there are any you can think of off the top of your head spam me here/in slack and I'll have a look. Otherwise I'll try find some to look at.

edit: adequately named link; https://blog.bitsrc.io/11-react-component-libraries-you-should-know-178eb1dd6aa4

@penx
Copy link
Collaborator Author

penx commented Oct 15, 2018

There’s a list in our readme. I’m planning to review this afternoon

@Loque-
Copy link
Collaborator

Loque- commented Oct 15, 2018

@penx
Copy link
Collaborator Author

penx commented Oct 15, 2018

Summary of approaches

Approaches

as prop

https://www.styled-components.com/docs/api#as-polymorphic-prop
emotion-js/emotion#837

Libs

Rebass

Uses an "as" prop

export const Link = styled(Box)(
  themed('Link')
)

Link.defaultProps = {
  as: 'a',
  color: 'blue'
}

https://github.com/rebassjs/rebass/blob/master/src/index.js#L101-L108

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

2 participants