import React from 'react'; import { Question } from 'gift-pegjs'; import TrueFalseQuestionDisplay from './TrueFalseQuestionDisplay/TrueFalseQuestionDisplay'; import MultipleChoiceQuestionDisplay from './MultipleChoiceQuestionDisplay/MultipleChoiceQuestionDisplay'; import NumericalQuestionDisplay from './NumericalQuestionDisplay/NumericalQuestionDisplay'; import ShortAnswerQuestionDisplay from './ShortAnswerQuestionDisplay/ShortAnswerQuestionDisplay'; import { AnswerType } from 'src/pages/Student/JoinRoom/JoinRoom'; // import useCheckMobileScreen from '../../services/useCheckMobileScreen'; import { StudentType } from '../../Types/StudentType'; interface QuestionProps { question: Question; handleOnSubmitAnswer?: (answer: AnswerType) => void; showAnswer?: boolean; students?: StudentType[]; isDisplayOnly?: boolean; answer?: AnswerType; } const QuestionDisplay: React.FC = ({ question, handleOnSubmitAnswer, showAnswer, students, isDisplayOnly = false answer, }) => { // const isMobile = useCheckMobileScreen(); // const imgWidth = useMemo(() => { // return isMobile ? '100%' : '20%'; // }, [isMobile]); let questionTypeComponent = null; switch (question?.type) { case 'TF': questionTypeComponent = ( ); break; case 'MC': questionTypeComponent = ( ); break; case 'Numerical': if (question.choices) { questionTypeComponent = ( ); } break; case 'Short': questionTypeComponent = ( ); break; } return (
{questionTypeComponent ? ( <> {questionTypeComponent} ) : (
Question de type inconnue
)}
); }; export default QuestionDisplay;