r/reactjs • • Sep 21 '20

Show /r/reactjs A responsive multi-level menu component I created using react hooks

1.2k Upvotes

49 comments sorted by

25

u/voxgtr Sep 21 '20

Seeing what people are able to make with Framer Motion is pretty impressive to see.

6

u/[deleted] Sep 21 '20

Awesome library.

17

u/[deleted] Sep 21 '20

Thanks everyone. Pretty new to web programing. I will fix the errors you pointed. It uses react portal to mount the container. Dragable button is just for testing position in various places. I used a custom hook to detect outside click which work in react portals. I will fix the hook to detect any activity outside element.

28

u/Brahminmeat Sep 21 '20

You should lock the drag of the ellipsis button when the menu is open. Right now I can open the menu and drag the icon away, leaving the menu behind.

10

u/[deleted] Sep 21 '20

I will look into it. Thanks for suggestion.

17

u/Brahminmeat Sep 21 '20

That, or fire a close event on the menu when the button is dragged

10

u/pakjones0 Sep 21 '20

OR have it drag the menu around with it

17

u/[deleted] Sep 21 '20

Dragable button is just to test positioning in all places

4

u/aadil_hasan Sep 21 '20

Hey that's just beautiful, is it open source?, I would like to use that in my extension https://getprotab.com.

2

u/[deleted] Sep 21 '20

Thank you.. Yes it is open source https://github.com/ruvkr/react-components-by-ruvkr

3

u/ollir Sep 21 '20

sample_items.js has an item "short by". Surely you meant "sort by"? But looking nice!

Edit: nvm, wasn't first to notice it

6

u/[deleted] Sep 21 '20

What about accessibility? If it’s accessible then you’ve really outdone yourself. If not and you’re up for a challenge, try making it accessible.

1

u/[deleted] Sep 22 '20

I never thought of that before. But i will. Thanks

3

u/GSN__ Sep 21 '20

Nice work, I have just started learning react and this project is definitely going to be in my to learn list. Just a small spelling mistake though, its "Sort by" not "Short by". Hope you dont mind :)

3

u/[deleted] Sep 21 '20

I'm pretty new too. I only started learning js last year.

1

u/_Invictuz Sep 21 '20

The end product looks impressive. You gonna stArt applying to jobs?

1

u/[deleted] Sep 22 '20

Once I finished my demo projects and portfolio site. I'm planing for next year.

2

u/Satan407 Sep 21 '20

Do you plan to release this as a ContextMenu library?

2

u/[deleted] Sep 22 '20

I never knew about contextmenu events. I will look into it. Thanks

2

u/gavlois1 I ❤️ hooks! 😈 Sep 21 '20

It looks great! However, it doesn't seem to be usable via keyboard (apart from opening and closing the menu), so I suspect this isn't accessible. If this can be made to be accessible, that would be totally awesome.

I noticed you mentioned you were pretty new to web programming. If so, then it's a perfect time to get the fundamentals of building accessible UIs.

1

u/[deleted] Sep 22 '20

Yes I will look into accessibility. Thank you

14

u/jpsreddit85 Sep 21 '20

Amazing coding, don't want to take away from that. But for usability, I personally hate menus where the back and cancel buttons jump around all over the place forcing me to mouse search for them. If I used this for any length of time I'd be cursing you.

1

u/cYzzie Sep 22 '20

Just tried it on an ipad pro and there is a weird flickering when opening 2nd level submenus- maybe try checking that out.

1

u/[deleted] Sep 22 '20

Do you mean the stretching of close button when changing levels?

1

u/cYzzie Sep 22 '20

no its really like a flickering of the text as if they are loaded/unloaded multiple times, do you have access to an ios device? i am sure its pretty easy to reproduce, if not just tell me again and i will do a screen recording

1

u/[deleted] Sep 22 '20

Sorry I don't have access to an ios device, a screen recording would be great. Can you test this in google chrome or firefox.

1

u/style-112 Sep 22 '20

great design... now step up your game and make ist accessible. e.g. with Reakit:

https://codesandbox.io/s/reakit-combobox-menu-with-submenu-28tl6?file=/src/styles.css

1

u/[deleted] Sep 22 '20

Thanks for the sandbox. Very helpful to get started.

2

u/Shakakai Sep 21 '20

I like the animation speed. I find it oddly satisfying :D

1

u/Taylowi Sep 21 '20

Very nice

1

u/Gnaquoia Sep 21 '20

Love this. Great work and great inspiration.

1

u/einsoft Sep 21 '20

Awesome! Congratulations for your good work.

1

u/BransonLite Sep 21 '20

Wow, looks great!

1

u/careseite Sep 21 '20

looks nice, sadly inaccessible

1

u/tbone6778 Sep 21 '20

Really nice looking. Working great on iOS

1

u/reindezvous8 Sep 22 '20

Very nice!

1

u/kp90001 Sep 22 '20

Thank you that's cool

1

u/[deleted] Sep 22 '20

Sooo slick

1

u/akza07 Sep 22 '20

I wish my Desktop OS had this kind of Aesthetically pleasing animation & colour scheme.

1

u/DJCowGaming Oct 07 '20

I'm not a js programer, but good job, very impressive! I totally know what this is...

0

u/[deleted] Sep 22 '20

[deleted]

1

u/[deleted] Sep 22 '20