frontPanel/src/pages/ViewPublicationPage/questions/Select.tsx

41 lines
1.0 KiB
TypeScript
Raw Normal View History

2023-11-30 17:39:57 +00:00
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>
);
};