frontPanel/src/pages/Questions/DropDown/settingDropDown.tsx

52 lines
1.9 KiB
TypeScript
Raw Normal View History

2023-09-06 13:20:12 +00:00
import { useParams } from "react-router-dom";
2023-08-25 10:27:43 +00:00
import { Box, Typography } from "@mui/material";
import CustomCheckbox from "@ui_kit/CustomCheckbox";
import CustomTextField from "@ui_kit/CustomTextField";
2023-08-25 10:27:43 +00:00
import { questionStore, updateQuestionsList } from "@root/questions";
import InfoIcon from "../../../assets/icons/InfoIcon";
2023-08-25 10:27:43 +00:00
type SettingDropDownProps = {
totalIndex: number;
};
export default function SettingDropDown({ totalIndex }: SettingDropDownProps) {
2023-09-06 13:20:12 +00:00
const quizId = Number(useParams().quizId);
2023-08-25 10:27:43 +00:00
const { listQuestions } = questionStore();
2023-08-25 10:27:43 +00:00
return (
<>
<Box
sx={{ display: "flex", width: "100%", justifyContent: "space-between" }}
>
<Box sx={{ padding: "20px", width: "100%" }}>
<Typography sx={{ marginBottom: "15px" }}>
Настройки ответов
</Typography>
<CustomCheckbox label={"Можно несколько"} />
<Typography sx={{ marginBottom: "15px" }}>
Текст в выпадающем списке
</Typography>
<CustomTextField
placeholder={"Выберите вариант"}
2023-09-06 13:20:12 +00:00
text={listQuestions[quizId][totalIndex].content.default}
2023-08-25 10:27:43 +00:00
onChange={({ target }) => {
2023-09-06 13:20:12 +00:00
const clonContent = listQuestions[quizId][totalIndex].content;
2023-08-25 10:27:43 +00:00
clonContent.default = target.value;
2023-09-06 13:20:12 +00:00
updateQuestionsList(quizId, totalIndex, { content: clonContent });
2023-08-25 10:27:43 +00:00
}}
/>
</Box>
<Box sx={{ padding: "20px" }}>
<Typography sx={{ marginBottom: "15px" }}>
Настройки вопросов
</Typography>
<CustomCheckbox label={"Необязательный вопрос"} />
<CustomCheckbox label={"Внутреннее название вопроса"} /> <InfoIcon />
</Box>
</Box>
</>
);
}