58 lines
1.7 KiB
TypeScript
58 lines
1.7 KiB
TypeScript
import { AnyTypedQuizQuestion } from "@model/questionTypes/shared";
|
|
import DataOptions from "./DataOptions/DataOptions";
|
|
import DropDown from "./DropDown/DropDown";
|
|
import Emoji from "./Emoji/Emoji";
|
|
import OptionsAndPicture from "./OptionsAndPicture/OptionsAndPicture";
|
|
import OptionsPicture from "./OptionsPicture/OptionsPicture";
|
|
import OwnTextField from "./OwnTextField/OwnTextField";
|
|
import PageOptions from "./PageOptions/PageOptions";
|
|
import RatingOptions from "./RatingOptions/RatingOptions";
|
|
import SliderOptions from "./SliderOptions/SliderOptions";
|
|
import UploadFile from "./UploadFile/UploadFile";
|
|
import AnswerOptions from "./answerOptions/AnswerOptions";
|
|
import { notReachable } from "../../utils/notReachable";
|
|
|
|
interface Props {
|
|
question: AnyTypedQuizQuestion;
|
|
}
|
|
|
|
export default function SwitchQuestionsPage({ question }: Props) {
|
|
switch (question.type) {
|
|
case "variant":
|
|
return <AnswerOptions question={question} />;
|
|
|
|
case "images":
|
|
return <OptionsPicture question={question} />;
|
|
|
|
case "varimg":
|
|
return <OptionsAndPicture question={question} />;
|
|
|
|
case "emoji":
|
|
return <Emoji question={question} />;
|
|
|
|
case "text":
|
|
return <OwnTextField question={question} />;
|
|
|
|
case "select":
|
|
return <DropDown question={question} />;
|
|
|
|
case "date":
|
|
return <DataOptions question={question} />;
|
|
|
|
case "number":
|
|
return <SliderOptions question={question} />;
|
|
|
|
case "file":
|
|
return <UploadFile question={question} />;
|
|
|
|
case "page":
|
|
return <PageOptions question={question} />;
|
|
|
|
case "rating":
|
|
return <RatingOptions question={question} />;
|
|
|
|
default:
|
|
notReachable(question);
|
|
}
|
|
}
|