41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
![]() |
import { Box, Typography } from "@mui/material";
|
||
|
import { useParams } from "react-router-dom";
|
||
|
|
||
|
import { Select as SelectComponent } from "../../../pages/Questions/Select";
|
||
|
|
||
|
import { questionStore, updateQuestionsList } from "@root/questions";
|
||
|
|
||
|
import type { QuizQuestionSelect } from "../../../model/questionTypes/select";
|
||
|
|
||
|
type SelectProps = {
|
||
|
question: QuizQuestionSelect;
|
||
|
};
|
||
|
|
||
|
export const Select = ({ question }: SelectProps) => {
|
||
|
const quizId = Number(useParams().quizId);
|
||
|
const { listQuestions } = questionStore();
|
||
|
const totalIndex = listQuestions[quizId].findIndex(
|
||
|
({ id }) => question.id === id
|
||
|
);
|
||
|
|
||
|
return (
|
||
|
<Box>
|
||
|
<Typography variant="h5">{question.title}</Typography>
|
||
|
<Box
|
||
|
sx={{
|
||
|
display: "flex",
|
||
|
flexDirection: "column",
|
||
|
width: "100%",
|
||
|
marginTop: "20px",
|
||
|
}}
|
||
|
>
|
||
|
<SelectComponent
|
||
|
items={question.content.variants.map(({ answer }) => answer)}
|
||
|
onChange={(action, num) => {
|
||
|
}}
|
||
|
/>
|
||
|
</Box>
|
||
|
</Box>
|
||
|
);
|
||
|
};
|