Poll: Adjust styles (#5616)
This commit is contained in:
parent
4b2bee8a2f
commit
4ddaceb86d
@ -7,7 +7,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.modal-content {
|
.modal-content {
|
||||||
padding: 0.5rem 1.25rem 1.875rem;
|
|
||||||
min-height: 4.875rem;
|
min-height: 4.875rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,7 +18,7 @@
|
|||||||
color: var(--color-text-secondary);
|
color: var(--color-text-secondary);
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
font-weight: var(--font-weight-medium);
|
font-weight: var(--font-weight-medium);
|
||||||
margin: 1.5rem 0.25rem;
|
margin-top: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.options-list {
|
.options-list {
|
||||||
@ -47,7 +46,7 @@
|
|||||||
|
|
||||||
.option-remove-button {
|
.option-remove-button {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0.3125rem;
|
top: 0.125rem;
|
||||||
right: 0.3125rem;
|
right: 0.3125rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,12 +54,16 @@
|
|||||||
.quiz-mode {
|
.quiz-mode {
|
||||||
margin-top: 1.5rem;
|
margin-top: 1.5rem;
|
||||||
|
|
||||||
|
.dialog-checkbox-group {
|
||||||
|
margin: 0 -1.125rem;
|
||||||
|
}
|
||||||
|
|
||||||
.options-header {
|
.options-header {
|
||||||
margin-bottom: 0.5rem;
|
margin-bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.note {
|
.note {
|
||||||
margin-top: 0.5rem;
|
margin-top: -1rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,4 +81,24 @@
|
|||||||
.input-group:last-child {
|
.input-group:last-child {
|
||||||
margin-bottom: 0.5rem;
|
margin-bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.radio-group {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.8125rem;
|
||||||
|
margin-left: -1.125rem;
|
||||||
|
|
||||||
|
.Radio, &:hover {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.Checkbox,
|
||||||
|
.Radio {
|
||||||
|
.Checkbox-main,
|
||||||
|
.Radio-main {
|
||||||
|
width: 100%;
|
||||||
|
max-height: 3rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -265,6 +265,7 @@ const PollModal: FC<OwnProps> = ({
|
|||||||
return options.map((option, index) => (
|
return options.map((option, index) => (
|
||||||
<div className="option-wrapper">
|
<div className="option-wrapper">
|
||||||
<InputText
|
<InputText
|
||||||
|
maxLength={MAX_OPTION_LENGTH}
|
||||||
label={index !== options.length - 1 || options.length === MAX_OPTIONS_COUNT
|
label={index !== options.length - 1 || options.length === MAX_OPTIONS_COUNT
|
||||||
? lang('OptionHint')
|
? lang('OptionHint')
|
||||||
: lang('CreatePoll.AddOption')}
|
: lang('CreatePoll.AddOption')}
|
||||||
@ -336,28 +337,27 @@ const PollModal: FC<OwnProps> = ({
|
|||||||
<div className="options-divider" />
|
<div className="options-divider" />
|
||||||
|
|
||||||
<div className="quiz-mode">
|
<div className="quiz-mode">
|
||||||
{!shouldBeAnonymous && (
|
<div className="dialog-checkbox-group">
|
||||||
|
{!shouldBeAnonymous && (
|
||||||
|
<Checkbox
|
||||||
|
label={lang('PollAnonymous')}
|
||||||
|
checked={isAnonymous}
|
||||||
|
onChange={handleIsAnonymousChange}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<Checkbox
|
<Checkbox
|
||||||
className="dialog-checkbox"
|
label={lang('PollMultiple')}
|
||||||
label={lang('PollAnonymous')}
|
checked={isMultipleAnswers}
|
||||||
checked={isAnonymous}
|
disabled={isQuizMode}
|
||||||
onChange={handleIsAnonymousChange}
|
onChange={handleMultipleAnswersChange}
|
||||||
/>
|
/>
|
||||||
)}
|
<Checkbox
|
||||||
<Checkbox
|
label={lang('PollQuiz')}
|
||||||
className="dialog-checkbox"
|
checked={isQuizMode}
|
||||||
label={lang('PollMultiple')}
|
disabled={isMultipleAnswers || isQuiz !== undefined}
|
||||||
checked={isMultipleAnswers}
|
onChange={handleQuizModeChange}
|
||||||
disabled={isQuizMode}
|
/>
|
||||||
onChange={handleMultipleAnswersChange}
|
</div>
|
||||||
/>
|
|
||||||
<Checkbox
|
|
||||||
className="dialog-checkbox"
|
|
||||||
label={lang('PollQuiz')}
|
|
||||||
checked={isQuizMode}
|
|
||||||
disabled={isMultipleAnswers || isQuiz !== undefined}
|
|
||||||
onChange={handleQuizModeChange}
|
|
||||||
/>
|
|
||||||
{isQuizMode && (
|
{isQuizMode && (
|
||||||
<>
|
<>
|
||||||
<h3 className="options-header">{lang('lng_polls_solution_title')}</h3>
|
<h3 className="options-header">{lang('lng_polls_solution_title')}</h3>
|
||||||
|
|||||||
@ -27,26 +27,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.poll-voters-count {
|
.poll-voters-count {
|
||||||
margin: 0.4375rem 0 1.125rem;
|
margin: 0 0 1.125rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.poll-answers {
|
|
||||||
padding-top: 0.25rem;
|
|
||||||
padding-bottom: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.Checkbox,
|
.Checkbox,
|
||||||
.Radio {
|
.Radio {
|
||||||
|
min-height: 2.5rem;
|
||||||
padding-left: 2.25rem;
|
padding-left: 2.25rem;
|
||||||
|
padding-bottom: 1.25rem;
|
||||||
&:last-child {
|
|
||||||
margin-bottom: 0.75rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:first-child {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.disabled {
|
&.disabled {
|
||||||
opacity: 1 !important;
|
opacity: 1 !important;
|
||||||
@ -59,13 +48,19 @@
|
|||||||
|
|
||||||
.Checkbox-main,
|
.Checkbox-main,
|
||||||
.Radio-main {
|
.Radio-main {
|
||||||
|
.label {
|
||||||
|
line-height: 1.3125rem;
|
||||||
|
}
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
|
top: 0.6875rem;
|
||||||
left: 0.125rem;
|
left: 0.125rem;
|
||||||
background-color: var(--background-color);
|
background-color: var(--background-color);
|
||||||
--color-borders-input: var(--secondary-color);
|
--color-borders-input: var(--secondary-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
|
top: 0.6875rem;
|
||||||
left: 0.4375rem;
|
left: 0.4375rem;
|
||||||
background-color: var(--accent-color);
|
background-color: var(--accent-color);
|
||||||
}
|
}
|
||||||
@ -79,11 +74,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.Spinner {
|
.Spinner {
|
||||||
|
top: 0.6875rem;
|
||||||
left: 0.125rem;
|
left: 0.125rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.Checkbox {
|
.Checkbox {
|
||||||
|
&.loading {
|
||||||
|
.Spinner {
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
.Checkbox-main {
|
.Checkbox-main {
|
||||||
&::after {
|
&::after {
|
||||||
left: 0.125rem;
|
left: 0.125rem;
|
||||||
@ -150,12 +151,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.poll-results,
|
|
||||||
.poll-answers {
|
|
||||||
padding-top: 0.25rem;
|
|
||||||
padding-bottom: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.Button {
|
.Button {
|
||||||
text-transform: none;
|
text-transform: none;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
@ -167,6 +162,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
> .Button {
|
> .Button {
|
||||||
margin-bottom: 0.625rem;
|
margin-bottom: 0.1875rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -270,7 +270,10 @@ const Poll: FC<OwnProps> = ({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{canVote && (
|
{canVote && (
|
||||||
<div className="poll-answers" onClick={stopPropagation}>
|
<div
|
||||||
|
className="poll-answers"
|
||||||
|
onClick={stopPropagation}
|
||||||
|
>
|
||||||
{isMultiple
|
{isMultiple
|
||||||
? (
|
? (
|
||||||
<CheckboxGroup
|
<CheckboxGroup
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
.PollOption {
|
.PollOption {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: row nowrap;
|
flex-flow: row nowrap;
|
||||||
margin-bottom: 0.75rem;
|
padding-bottom: 0.5rem;
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
@ -59,7 +59,7 @@
|
|||||||
|
|
||||||
.poll-option-right {
|
.poll-option-right {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
line-height: 1.5rem;
|
line-height: 1.3125rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.poll-option-answer {
|
.poll-option-answer {
|
||||||
|
|||||||
@ -9,6 +9,8 @@ import type { ApiPollAnswer, ApiPollResult } from '../../../api/types';
|
|||||||
import buildClassName from '../../../util/buildClassName';
|
import buildClassName from '../../../util/buildClassName';
|
||||||
import { renderTextWithEntities } from '../../common/helpers/renderTextWithEntities';
|
import { renderTextWithEntities } from '../../common/helpers/renderTextWithEntities';
|
||||||
|
|
||||||
|
import useLang from '../../../hooks/useLang';
|
||||||
|
|
||||||
import Icon from '../../common/icons/Icon';
|
import Icon from '../../common/icons/Icon';
|
||||||
|
|
||||||
import './PollOption.scss';
|
import './PollOption.scss';
|
||||||
@ -30,6 +32,7 @@ const PollOption: FC<OwnProps> = ({
|
|||||||
correctResults,
|
correctResults,
|
||||||
shouldAnimate,
|
shouldAnimate,
|
||||||
}) => {
|
}) => {
|
||||||
|
const lang = useLang();
|
||||||
const result = voteResults && voteResults.find((r) => r.option === answer.option);
|
const result = voteResults && voteResults.find((r) => r.option === answer.option);
|
||||||
const correctAnswer = correctResults.length === 0 || correctResults.indexOf(answer.option) !== -1;
|
const correctAnswer = correctResults.length === 0 || correctResults.indexOf(answer.option) !== -1;
|
||||||
const showIcon = (correctResults.length > 0 && correctAnswer) || (result?.isChosen);
|
const showIcon = (correctResults.length > 0 && correctAnswer) || (result?.isChosen);
|
||||||
@ -51,7 +54,7 @@ const PollOption: FC<OwnProps> = ({
|
|||||||
const lineStyle = `width: ${lineWidth}%; transform:scaleX(${isAnimationDoesNotStart ? 0 : 1})`;
|
const lineStyle = `width: ${lineWidth}%; transform:scaleX(${isAnimationDoesNotStart ? 0 : 1})`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="PollOption" dir="ltr">
|
<div className="PollOption" dir={lang.isRtl ? 'rtl' : undefined}>
|
||||||
<div className={`poll-option-share ${answerPercent === '100' ? 'limit-width' : ''}`}>
|
<div className={`poll-option-share ${answerPercent === '100' ? 'limit-width' : ''}`}>
|
||||||
{answerPercent}%
|
{answerPercent}%
|
||||||
{showIcon && (
|
{showIcon && (
|
||||||
|
|||||||
@ -48,6 +48,10 @@
|
|||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
> input {
|
> input {
|
||||||
@ -92,7 +96,7 @@
|
|||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
unicode-bidi: plaintext;
|
unicode-bidi: plaintext;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
line-height: 1.25rem;
|
line-height: 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.subLabel {
|
.subLabel {
|
||||||
|
|||||||
@ -48,6 +48,7 @@ const Radio: FC<OwnProps> = ({
|
|||||||
onSubLabelClick,
|
onSubLabelClick,
|
||||||
}) => {
|
}) => {
|
||||||
const lang = useOldLang();
|
const lang = useOldLang();
|
||||||
|
|
||||||
const fullClassName = buildClassName(
|
const fullClassName = buildClassName(
|
||||||
'Radio',
|
'Radio',
|
||||||
className,
|
className,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user