DevLeonardoCommunity / github-stats

Aggregating and displaying YOUR GitHub Stats in meaningful metrics (we learn web development in the meantime)
https://public-github-stats.vercel.app
MIT License
71 stars 37 forks source link

feat: close dropdown on item click #111

Closed theflucs closed 8 months ago

theflucs commented 9 months ago

Added the functionality of closing the dropdown as soon as one of its item is clicked.

There are few repetitions in the code, though: one is about the export dropdown, which can be resolved creating an ExportDropdownButton component. The second one is about the use of the closeDropdownOnItemClick util function, which is attached to the dropdown anytime we use it. If we decide to have this functionality throughout the app, maybe a component wrapper could be helpful?

@Balastrong what do you think about these considerations?

I leave the PR on draft for now. Thank you

netlify[bot] commented 9 months ago

Deploy request for public-github-stats pending review.

Visit the deploys page to approve it

Name Link
Latest commit 68b8d3b470eff21fd1adcbef6284889d9f2745eb
Balastrong commented 9 months ago

Instead of writing an util to close the dropdown, which we have to remember to add on each new dropdown, I'd probably go with a generic Dropdown component that handles the logic by itself.

theflucs commented 8 months ago

@Balastrong this refactoring has been quite a journey! At the end of which I am not sure it's worth to have it, because It added a level of complexity to the code base. Have a look and tell me what you think. Anyway it's been interesting to implement it for the sake of learning. I also had to touch the ThemeSelector test, see the fix test error commit. It's not clear to me why it got broken after my changes. Thank you