2023-11-16 16:41:25 +00:00
|
|
|
import { QuizQuestionText } from "@model/questionTypes/text";
|
2023-03-31 15:48:49 +00:00
|
|
|
import HelpQuestions from "../helpQuestions";
|
|
|
|
import SettingTextField from "./settingTextField";
|
2024-02-14 02:45:13 +00:00
|
|
|
import UploadImage from "../UploadImage";
|
2023-03-31 15:48:49 +00:00
|
|
|
|
|
|
|
interface Props {
|
2023-12-31 02:53:25 +00:00
|
|
|
switchState: string;
|
|
|
|
question: QuizQuestionText;
|
2023-03-31 15:48:49 +00:00
|
|
|
}
|
|
|
|
|
2024-05-29 16:41:41 +00:00
|
|
|
export default function SwitchTextField({ switchState = "setting", question }: Props) {
|
2023-12-31 02:53:25 +00:00
|
|
|
switch (switchState) {
|
|
|
|
case "setting":
|
2024-02-29 11:23:52 +00:00
|
|
|
return (
|
|
|
|
<SettingTextField
|
|
|
|
questionId={question.id}
|
|
|
|
isRequired={question.content.required}
|
2024-05-29 16:41:41 +00:00
|
|
|
isAutofill={question.content.autofill}
|
|
|
|
isOnlyNumbers={question.content.onlyNumbers}
|
|
|
|
answerType={question.content.answerType}
|
2024-02-29 11:23:52 +00:00
|
|
|
/>
|
|
|
|
);
|
2024-02-14 02:45:13 +00:00
|
|
|
case "image":
|
2024-05-29 16:41:41 +00:00
|
|
|
return <UploadImage question={question} cropAspectRatio={{ width: 400, height: 300 }} />;
|
2023-12-31 02:53:25 +00:00
|
|
|
case "help":
|
2024-02-29 11:23:52 +00:00
|
|
|
return (
|
|
|
|
<HelpQuestions
|
|
|
|
questionId={question.id}
|
|
|
|
hintText={question.content.hint.text}
|
|
|
|
hintVideo={question.content.hint.video}
|
|
|
|
/>
|
|
|
|
);
|
2023-12-31 02:53:25 +00:00
|
|
|
default:
|
|
|
|
return <></>;
|
|
|
|
}
|
2023-08-24 11:09:47 +00:00
|
|
|
}
|