FEATURE: Add a preview to the poll builder (PR #7988)

Closes Show preview in poll builder - ux - Discourse Meta

Shout out to @pmusaraj for the recent poll builder tweaks. Saved me some CSS tweaking! :smiley:

I’ve hardcoded both column widths, which isn’t ideal, but modal’s max-width means that it expands horizontally as you type (until it reaches that max width). As far as I know, there is no way to force a flex element to fill all the available space up to the max-width. I’m open to suggestions. :wink:

Oh, and the poll-ui-builder.hbs diff looks messy only because I’ve wrapped all the poll options in a <div class="options">.

GitHub

1 Like

Thanks for contributing this pull request! Could you please sign our CLA so we can review it? http://www.discourse.org/cla

(confirmed CLA was signed)

1 Like

This looks quite good to me. Do you have any feedback @jjaffeux ?

LGTM :+1:

Only thing, you could use the selectKit helper for your test:

const subject = selectKit(selector);
await subject.expand();
await subject.selectRowByValue("xxx");

It’s more verbose but it ensures we respect some UI flow and also if we change select-kit internals we can still make tests work without changing them.

1 Like

Also minor but one .poll-ui-builder-form is in a poll.scss file and ther other in poll-ui-builder.scss file, should we move all in poll.scss or have another poll-ui-builder.scss for mobile?.

Both are good points @jjaffeux, I’ve updated the PR. :slightly_smiling_face:

Tests failed due to an unrelated flaky test. Forcing rebuild.

Thanks, merging it in.