abhijithvijayan / react-minimal-side-navigation

Minimal side navigation component for React
https://codesandbox.io/s/react-minimal-side-navigation-example-y299d?file=/src/components/NavSidebar.jsx
MIT License
67 stars 28 forks source link

Component does not return parent id #7

Closed sirdawidd closed 3 years ago

sirdawidd commented 3 years ago

In case subNav is empty (And user selected on root element) <Navigation onSelect={({itemId}) => { will return itemId }}

In case subNav is not empty (And user selected on root element) <Navigation onSelect={({itemId}) => { will return not return anything }}

Which is a problem as in my case the Root menu elements render the page, where sub Nav items, are only used to scroll to position. Anyway when component sometimes return ItemId and in some conditions does not it's not consistent behavior of it.

abhijithvijayan commented 3 years ago

Do you have a fix for this?

I will merge it asap.

abhijithvijayan commented 3 years ago

Also, try to create a sandbox with your issue for me to look into.

abhijithvijayan commented 3 years ago

Fixed the case if subNav is [] in v1.7.1.

abhijithvijayan commented 3 years ago

Also, for consistency, every click will call the callback method passed in props.

Other issues are also fixed as well from v.1.8.0

https://user-images.githubusercontent.com/34790378/108617955-4805ca00-7440-11eb-8a35-e9b31d261a11.mp4