DEV: adds a new dropdown widget usable in any widget (PR #9297)

Screenshot 2020-03-28 at 15 18 38 Screenshot 2020-03-28 at 15 22 54 Screenshot 2020-03-28 at 15 24 30

Note this commit needs: https://github.com/discourse/discourse/pull/9296

GitHub

I assume translatedLabel is not mandatory – you need one of either label/translatedLabel?

Wow you ported select-kit to widgets!

(I know, not really, it’s a subset.)

I do like it, but I also wonder if in the future we migrate away from widgets do we want to add a bunch of code like this?

I suppose it has a good migration path to swap it out for select-kit. So yes, approved :slight_smile:

I can’t decide if I hate this or not :smiley:

On one hand nested ternary operators make my brain hurt, but on the other I fully understand what this is doing. I am leaning towards “let’s keep it.”

A bool for adding a class doesn’t scale well if you’d ever want to add another class to that header/button. Wouldn’t explicitly passing a class list be better?

Yes right will clarify this :+1:

Yes I feel the same :smiley:

yes agreed it feels a little bit hacky… I just thought this is a very common case, so I could make it explicit as btn-small requires you to know the internals of the dropdown

Wow you ported select-kit to widgets!

(I know, not really, it’s a subset.)

I do like it, but I also wonder if in the future we migrate away from widgets do we want to add a bunch of code like this?

I suppose it has a good migration path to swap it out for select-kit. So yes, approved :slight_smile:

Yes agreed… but who knows when this future will be.

Also yes it has a very similar API and at the very least the same conceptual approach than select-kit so going from this a select-kit component should be very easy. I expect not more than one hour of work by widget dropdown to be converted when possible.