Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

PollAnswer.js 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // @flow
  2. import { Checkbox } from '@atlaskit/checkbox';
  3. import React from 'react';
  4. import { isSubmitAnswerDisabled } from '../../functions';
  5. import AbstractPollAnswer from '../AbstractPollAnswer';
  6. import type { AbstractProps } from '../AbstractPollAnswer';
  7. const PollAnswer = (props: AbstractProps) => {
  8. const {
  9. creatorName,
  10. checkBoxStates,
  11. poll,
  12. setCheckbox,
  13. skipAnswer,
  14. skipChangeVote,
  15. submitAnswer,
  16. t
  17. } = props;
  18. const { changingVote } = poll;
  19. return (
  20. <div className = 'poll-answer'>
  21. <div className = 'poll-header'>
  22. <div className = 'poll-question'>
  23. <span>{ poll.question }</span>
  24. </div>
  25. <div className = 'poll-creator'>
  26. { t('polls.by', { name: creatorName }) }
  27. </div>
  28. </div>
  29. <ol className = 'poll-answer-list'>
  30. {
  31. poll.answers.map((answer, index) => (
  32. <li
  33. className = 'poll-answer-container'
  34. key = { index }>
  35. <Checkbox
  36. isChecked = { checkBoxStates[index] }
  37. key = { index }
  38. label = { <span className = 'poll-answer-option'>{ answer.name }</span> }
  39. // eslint-disable-next-line react/jsx-no-bind
  40. onChange = { ev => setCheckbox(index, ev.target.checked) }
  41. size = 'large' />
  42. </li>
  43. ))
  44. }
  45. </ol>
  46. <div className = 'poll-footer poll-answer-footer' >
  47. <button
  48. aria-label = { t('polls.answer.skip') }
  49. className = 'poll-button poll-button-secondary poll-button-shortest'
  50. onClick = { changingVote ? skipChangeVote : skipAnswer } >
  51. <span>{t('polls.answer.skip')}</span>
  52. </button>
  53. <button
  54. aria-label = { t('polls.answer.submit') }
  55. className = 'poll-button poll-button-primary poll-button-shortest'
  56. disabled = { isSubmitAnswerDisabled(checkBoxStates) }
  57. onClick = { submitAnswer }>
  58. <span>{t('polls.answer.submit')}</span>
  59. </button>
  60. </div>
  61. </div>
  62. );
  63. };
  64. /*
  65. * We apply AbstractPollAnswer to fill in the AbstractProps common
  66. * to both the web and native implementations.
  67. */
  68. // eslint-disable-next-line new-cap
  69. export default AbstractPollAnswer(PollAnswer);