krishnanlab / geneplexus-app-v2

GenePlexus App - backend (cloud functions) and frontend
https://gene-plexus.netlify.app/
2 stars 0 forks source link

Component cleanup #33

Closed vincerubinetti closed 1 month ago

vincerubinetti commented 2 months ago

Okay. This PR is an attempt to make the components simpler, more maintainable, more readable, etc. I switched from Zag.js -- which is great and highly customizable, but very verbose and probably indecipherable for someone not familiar with React -- to higher-level libraries. Basically all of the popular libraries -- React Aria Components, Headless UI, Radix UI -- have some critical component missing, so I had to mix and match them. They also all have some kind of blind spot that requires dirty hacks. This is just the state of web development; nothing we can do. There is also Ark UI (the high-level version of Zag), but I feel it is too new and untested. I also opted to switch to just vanilla HTML/JS components where appropriate (e.g. checkbox, radio buttons), and it ended up being just as clean imo. I also got rid of the overly-clever "label" wrapper component I had, which handled showing a label, help tooltip, and layout of the label and the child control. While getting rid of it results in some duplicate code (props, CSS), I feel it makes each component easier to read. Also, ultimately, each component needed slightly different styling anyway, and trying to make that work consistently with the same label wrapper proved to be frustrating.

Though the diff doesn't result in a large overall line difference, hopefully these changes just make things simpler and more maintainable in the long run.

Note that a lot of these changes are not as significant as the diff makes them seem, e.g. going from () => { return <>some component</> } to () => <>some component</>.

All components were tested uncontrolled and controlled, and in FormData usage.

netlify[bot] commented 2 months ago

Deploy Preview for gene-plexus ready!

Name Link
Latest commit 3418a8f1631c42d404484cae00aea3f0a8385e0b
Latest deploy log https://app.netlify.com/sites/gene-plexus/deploys/66575b28e5b4a30008ed1e41
Deploy Preview https://deploy-preview-33--gene-plexus.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.