import { useParams } from "react-router-dom";
import { Box, Typography } from "@mui/material";

import CustomTextField from "@ui_kit/CustomTextField";

import { questionStore, updateQuestionsList } from "@root/questions";

import type { QuizQuestionText } from "../../../model/questionTypes/text";

type TextProps = {
  question: QuizQuestionText;
};

export const Text = ({ question }: TextProps) => {
  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",
        }}
      >
        <CustomTextField placeholder={question.content.placeholder} />
      </Box>
    </Box>
  );
};
