import { MAX_ANSWER_LENGTH } from 'common/answer' import { useState } from 'react' import Textarea from 'react-expanding-textarea' import { XIcon } from '@heroicons/react/solid' import { Col } from '../layout/col' import { Row } from '../layout/row' export function MultipleChoiceAnswers(props: { setAnswers: (answers: string[]) => void }) { const [answers, setInternalAnswers] = useState(['', '', '']) const setAnswer = (i: number, answer: string) => { const newAnswers = setElement(answers, i, answer) setInternalAnswers(newAnswers) props.setAnswers(newAnswers) } const removeAnswer = (i: number) => { const newAnswers = answers.slice(0, i).concat(answers.slice(i + 1)) setInternalAnswers(newAnswers) props.setAnswers(newAnswers) } const addAnswer = () => setAnswer(answers.length, '') return ( {answers.map((answer, i) => ( {i + 1}.{' '}