question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v2 add NavAnchor and NavButton

See original GitHub issue

A common need for a UI app is a component that handles navigational links, where there is some built-in logic to handle the active route. A counterpart in react router is NavLink.

It seems to me that Grommet should have two extra components: NavAnchor and NavButton. These components will add some logic for detecting if the route is active, and add styling to it. this style would live in the theme object, something like:

const myCustomTheme = {
  navAnchor: {
    active: css`
      text-decoration: underline;
    `
  },
};

Thoughts?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:16 (15 by maintainers)

github_iconTop GitHub Comments

2reactions
ericsoderberghpcommented, Aug 27, 2018

Why not extend RoutedAnchor and RoutedButton?

1reaction
ericsoderberghpcommented, Feb 20, 2019

I think we should not get tied to routing libraries, which would be required to “add some logic for detecting if the route is active”. Instead, I think we should ensure that we support active on Button and Anchor, along with theme-ability of that. We could provide starters/patterns/templates showing how to integrate with various routing libraries, such as react-router, nextjs, etc. For example, see RoutedButton.js in https://codesandbox.io/s/216vvpmlqj.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to handle the navigation for the Button click in ReactJS?
2. I am getting an error as "Cannot read property 'push' of undefined" ... npm install prop-types --save or yarn add prop-types.
Read more >
Revolution Slider: Full screen is extending below fold. Can' ...
This is unlike the Integrity 1 demo which ends nicely at full screen, and the nav anchor is right above the fold and...
Read more >
Migrating to v1
Local onSelect handlers are ignored when in the context of a TabContainer or Navbar (MAYBE ADD BACK?) Nav.Item#. Renders only the outer "item"...
Read more >
dynamic navigation menu - Using Umbraco And Getting ...
Hi,. I'm trying to create a dynamic navigtaion menu as MegaNav isnt here for Umbraco8 yet. I've got the following code which works...
Read more >
Changing color of active nav bar link
Andy_Vaughan (Jolly Good Web) April 19, 2020, 10:08am #2 ... the top right of the Designer when you have the nav button element...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found