From 37b3985bfac5ffdc8e452f92869dcdefb5c92594 Mon Sep 17 00:00:00 2001 From: Sasha Sorokin Date: Thu, 2 Apr 2020 22:10:55 +0700 Subject: [PATCH] Improve polls: option lengths & redesign (#13257) This commit redesign the polls and increases characters limit for the options from 25 to 50 characters, giving pollsters more freedom. Summarizing, the redesign is making the polls more adaptive for upcoming changes to the options characters limit: the bar, or a "chart", is now displayed separately from the option itself; vote check mark is moved next to the option text, making the percentages take less space. Option lengths are taken into account and text is wrapped to multiple lines if necessary to avoid overflow. --- app/javascript/mastodon/components/poll.js | 28 ++++++++----- .../features/compose/components/poll_form.js | 4 +- .../styles/mastodon-light/diff.scss | 2 +- app/javascript/styles/mastodon/polls.scss | 40 ++++++++++--------- app/validators/poll_validator.rb | 2 +- app/views/statuses/_poll.html.haml | 10 ++--- 6 files changed, 48 insertions(+), 38 deletions(-) diff --git a/app/javascript/mastodon/components/poll.js b/app/javascript/mastodon/components/poll.js index 3a17e80e7..7525a1030 100644 --- a/app/javascript/mastodon/components/poll.js +++ b/app/javascript/mastodon/components/poll.js @@ -127,15 +127,7 @@ class Poll extends ImmutablePureComponent { return (
  • - {showResults && ( - - {({ width }) => - - } - - )} - -
  • ); } diff --git a/app/javascript/mastodon/features/compose/components/poll_form.js b/app/javascript/mastodon/features/compose/components/poll_form.js index fa2b0609e..2f37ce64b 100644 --- a/app/javascript/mastodon/features/compose/components/poll_form.js +++ b/app/javascript/mastodon/features/compose/components/poll_form.js @@ -75,7 +75,7 @@ class Option extends React.PureComponent { return (
  • -