react-simple-sidenav icon indicating copy to clipboard operation
react-simple-sidenav copied to clipboard

Is there anyway to highlight active page and to use the whole Item as Link?

Open DrXtreme opened this issue 7 years ago • 1 comments

I like this component but it can be better with dynamic active tab. I primarily want to highlight the active Link and to use the whole "li" as a Link component so that you can click anywhere on it and it will work.

DrXtreme avatar Apr 08 '19 00:04 DrXtreme

Try this:

<SideNav
  ...
  items={navItems}
/>

const navItems = [
    <NavLink activeStyle={styles} onClick={onHideNav} to="/" exact>Home</NavLink>,
    <NavLink activeStyle={styles} onClick={onHideNav} to="/login">Login</NavLink>,
...
]

const styles = {
    color: 'black',
    fontWeight: 'bold',
    cursor: 'default',
    pointEvents: 'none',
  };

EvgenyLeukhin avatar May 29 '20 05:05 EvgenyLeukhin