acmerobotics / ftc-dashboard

React-based web dashboard designed for FTC
https://acmerobotics.github.io/ftc-dashboard
Other
168 stars 125 forks source link

Phase out styled-components #117

Closed NoahBres closed 1 year ago

NoahBres commented 1 year ago

I introduced styled-components as a cleaner alternative to introduce custom CSS styling for components. However, I really dislike the verbosity and duplicated information when paired with TypeScript. styled-components seems really great as a custom design system from the ground up. However, because of the heavy TailwindCSS use, most of the powerful features styled-components provides are completely unnecessary.

Most of the verbosity stems from TypeScript. styled-components requires two separate typings, one for typing props that will be added to the component directly (such as adding to className) and one for the template literals. I am sure the code would be much cleaner in a vanilla JS environment

CleanShot 2022-12-08 at 01 02 03@2x

I really dislike the lambdas to access the props. CleanShot 2022-12-08 at 01 04 59@2x

I will slowly be converting these back to normal components.

They are not actually any shorter, nor do I think they look much cleaner. In fact, I almost prefer how styed-components look. But they are much less annoying.

CleanShot 2022-12-08 at 01 08 30@2x ➡️➡️ CleanShot 2022-12-08 at 01 07 41@2x

NoahBres commented 1 year ago

This is silly lol. There is literally no reason to be using styled-components. Poor decision on my part.

CleanShot 2022-12-08 at 01 12 15@2x