import { useState, useEffect } from "react"; import { Box, Typography } from "@mui/material"; import CustomCheckbox from "@ui_kit/CustomCheckbox"; import InfoIcon from "../../../assets/icons/InfoIcon"; import * as React from "react"; import CustomTextField from "@ui_kit/CustomTextField"; import { questionStore, updateQuestionsList } from "@root/questions"; import type { ChangeEvent } from "react"; interface Props { totalIndex: number; } export default function ResponseSettings({ totalIndex }: Props) { const [checked, setChecked] = useState(false); const { listQuestions } = questionStore(); const handleChange = (event: ChangeEvent) => { setChecked(event.target.checked); }; useEffect(() => { if (listQuestions[totalIndex].content.innerName.length) { setChecked(true); } }, []); return ( Настройки ответов { let clonContent = listQuestions[totalIndex].content; clonContent.large = e.target.checked; updateQuestionsList(totalIndex, { content: clonContent }); }} /> { let clonContent = listQuestions[totalIndex].content; clonContent.multi = e.target.checked; updateQuestionsList(totalIndex, { content: clonContent }); }} /> { let clonContent = listQuestions[totalIndex].content; clonContent.own = e.target.checked; updateQuestionsList(totalIndex, { content: clonContent }); }} /> Настройки вопросов { updateQuestionsList(totalIndex, { required: !e.target.checked }); }} /> {" "} {checked && ( { let clonContent = listQuestions[totalIndex].content; clonContent.innerName = target.value; updateQuestionsList(totalIndex, { content: clonContent }); }} /> )} ); }