Context: I could have easily made it under 100 lines, but the 1000 lines for a dropdown is actually more easily managed, I learned the lesson of life,
"Somethings are better off being a Spaghetti "
I just love When devs are showcasing code. There’s jackpot for “I haven’t optimized the code” every time 😂
hahaha, true
I know shadcn when I see it
We are alike, infact any component with Content will be shadcn forsure,
I see you're just tightly coupled to shadcn, no attempt to wrap the drop down... fighing this in my current codebase, with hundreds of shadcn components with completely different implementations
Can you elaborate on problems? I am yet to face any
Cannot procedurally generate forms even though all the logic is there, because inputs are not consistent
No central handling of theming and theme change management
Context switching between components like this Dropdown with its various child components, vs a Select with prop based handling, etc
Source code is unintuitive so devs have to trawl through shadcn docs and tutorials just to learn how to use one internal component, and then do it again for every other one because they're all slightly different
Consistency matters in a large codebase, and these make it very difficult (or the dev who did it didn't put any thought into it)
Ahh i understand,
I will try to recreate some of problems, but yes the docs crawling makes sense
If your solution for making it under 100 would have been pulling out a bunch of single-use components then my personal preference would also be to keep it at 1000.
Single-use components have their uses (you definitely need some e.g for distinct pages) but they feel way overused and often lead to a ton of unnecessary prop drilling.
EXACTLY! my friend
Plus it would have increased the data layers by making abstractions, and since it has a bunch of functions which are only used once like language switcher (i am not using it anywhere because dropdown is visible on all pages) then there is no need for making different files.
I wouldn't try to make a bunch of single use components but maybe try to use a loop create the dropdown items, and an array of items with things like label, icon, state and command function for action.
The dropdowns in my current system aren't that big and I am already thing about doing this.
This is why I have a 6k line component