import React, { useState } from 'react'; import '../questionStyle.css'; import { Button, TextField } from '@mui/material'; import { FormattedTextTemplate } from '../../GiftTemplate/templates/TextTypeTemplate'; import { ShortAnswerQuestion } from 'gift-pegjs'; interface Props { question: ShortAnswerQuestion; handleOnSubmitAnswer?: (answer: string) => void; showAnswer?: boolean; } const ShortAnswerQuestionDisplay: React.FC = (props) => { const { question, showAnswer, handleOnSubmitAnswer } = props; const [answer, setAnswer] = useState(); return (
{showAnswer ? ( <>
{question.choices.map((choice) => (
{choice.text}
))}
{question.formattedGlobalFeedback &&
} ) : ( <>
{ setAnswer(e.target.value); }} disabled={showAnswer} aria-label="short-answer-input" />
{handleOnSubmitAnswer && ( )} )}
); }; export default ShortAnswerQuestionDisplay;