import React, { useState } from "react"; import { useNavigate } from "react-router-dom"; import { BasicQuestionType, AnswerType, SurveyType } from "../types"; import { ACheckboxForm } from "./ACheckboxForm"; import { ADateForm } from "./ADateForm"; import { ADropdownForm } from "./ADropdownForm"; import { AEssayForm } from "./AEssayForm"; import { AFileForm } from "./AFileForm"; import { ARadioForm } from "./ARadioForm"; import { ARatingForm } from "./ARatingForm"; type Props = { question: BasicQuestionType; response: AnswerType; handleAnswer: () => void; addFiles: (oneFile: { questionId: string; file: File }) => void; }; export const AQuestion = ({ question, handleAnswer, response, addFiles, }: Props) => { function getContent(question: BasicQuestionType) { switch (question.type) { case "essay": return ( ); case "radio": return ( ); case "checkbox": return ( ); case "dropdown": return ( ); case "file": return ( ); case "rating": return ( ); case "date": return ( ); default: return <>; } } return (
{question.title}
{question.comment}
{getContent(question)}
); };