import React from 'react'; import Button from '/imports/ui/components/button/component'; import styles from './styles.scss'; import { defineMessages, injectIntl } from 'react-intl'; const intlMessages = defineMessages({ pollingTitleLabel: { id: 'app.polling.pollingTitle', description: 'Title label for polling options', }, }); class PollingComponent extends React.Component { constructor(props) { super(props); } getStyles() { const number = this.props.poll.answers.length + 1; const buttonStyle = { width: `calc(75%/ ${number} )`, marginLeft: `calc(25%/${number * 2})`, marginRight: `calc(25%/${number * 2})`, }; return buttonStyle; } render() { const poll = this.props.poll; const calculatedStyles = this.getStyles(); const { intl } = this.props; return (

{intl.formatMessage(intlMessages.pollingTitleLabel)}

{poll.answers.map((pollAnswer, index) => (
), )}
); } } export default injectIntl(PollingComponent);