jamdotdev / jam-dev-utilities

Lightweight utils set - fast and open-source. It's got cmd+k search & everything's client-side. No ads, your data stays local.
https://jam.dev/utilities
GNU General Public License v3.0
254 stars 26 forks source link

feat: add toggle button to Number Base Changer #68

Closed skredev closed 1 month ago

skredev commented 1 month ago

Hello everyone!

I've added a toggle button between the from and to inputs to quickly toggle the conversion in the Number Base Changer, as requested in #57. This feature enables users to switch between the two options with greater ease and convenience.

The switch button can now also be added to other utilities that use the ComboboxComponent. The ComboboxComponent has been updated without affecting other use cases that do not utilize the switch button.

Looking forward to hearing your feedback! ๐Ÿ˜ƒ

peckz commented 1 month ago

@sprechblase Thanks for making this PR, it's great UX idea!

I believe the whole logic could be simplified, I'm gonna write a few comments about it. From my perspective, it's quite hard to digest what's the difference between:

As review comments are not sorted in a same way when I wrote them, it might be complicated to read them. The idea is to have only one useState which will store values like { from: number, to: number}.

Then refactor ComboBox, remove defaultValue and internalValue only leave value prop. After that adapt other places in code base where defaultValue was used.

If you have any questions or need help, please let me know!

peckz commented 1 month ago

@sprechblase I left few comments about refactoring and simplifying logic, please once you're done with it, don't forget to change defaultValue to value in these components:

If you need any help please let me know, it might be too much changes, but I believe it's gonna make DX easier in the future!

skredev commented 1 month ago

@peckz I made all the changes you requested and also added the new Switch button and the new simplified logic to the CSS Units Converter.

Thank you very much for your feedback!

peckz commented 1 month ago

@sprechblase Thank you! Welcome to the contributors list! ๐Ÿ™Œ

danigrant commented 1 month ago

This is so awesome, I love it! Thank you for adding this! ๐Ÿ˜ƒ

Can we send you a Jam hat? ๐Ÿงข My email is dani@jam.dev โ€“ let me know a good mailing address for you and a hat will be on its way!