import { Box, Checkbox, FormControl, FormControlLabel, IconButton, InputAdornment, Paper, TextField, useTheme } from "@mui/material"; import CustomTextField from "@ui_kit/CustomTextField"; import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; import ExpandLessIcon from '@mui/icons-material/ExpandLess'; import OneIcon from "@icons/questionsPage/OneIcon"; import PointsIcon from "@icons/questionsPage/PointsIcon"; import TypeQuestions from "./TypeQuestions"; import SwitchQuestionsPage from "./SwitchQuestionsPage"; import React, {useState} from "react"; import DeleteIcon from "@icons/questionsPage/deleteIcon"; import {useParams} from "react-router-dom"; import {questionStore, updateQuestionsList, removeQuestion} from "@root/questions"; import CopyIcon from "@icons/questionsPage/CopyIcon"; import CrossedEyeIcon from "@icons/CrossedEyeIcon"; import HideIcon from "@icons/questionsPage/hideIcon"; import Answer from "@icons/questionsPage/answer"; import OptionsPict from "@icons/questionsPage/options_pict"; import OptionsAndPict from "@icons/questionsPage/options_and_pict"; import Emoji from "@icons/questionsPage/emoji"; import Input from "@icons/questionsPage/input"; import DropDown from "@icons/questionsPage/drop_down"; import Date from "@icons/questionsPage/date"; import Slider from "@icons/questionsPage/slider"; import Download from "@icons/questionsPage/download"; import Page from "@icons/questionsPage/page"; import RatingIcon from "@icons/questionsPage/rating"; interface Props { totalIndex: number } const IconAndrom = (isExpanded:boolean, switchState:string) => { switch (switchState) { case 'variant': return (); case 'images': return (); case 'varimg': return (); case 'emoji': return (); case 'text': return (); case 'select': return (); case 'date': return (); case 'number': return (); case 'file': return (); case 'page': return (); case 'rating': return (); default: return (<>) } } export default function QuestionsPageCard({totalIndex}: Props) { function onDragStart(event: any) { event .dataTransfer .setData('text', event.target.id); } const theme = useTheme(); const {listQuestions} = questionStore() const [isExpanded, setIsExpanded] = useState(false); const switchState = listQuestions[totalIndex].type console.log(listQuestions[totalIndex].type) console.log(totalIndex) return ( { updateQuestionsList(totalIndex, {title: e.target.value}) console.log(listQuestions[totalIndex].title) }} InputProps={{ startAdornment: ( {IconAndrom(isExpanded, switchState)} ), }} sx={{ "& .MuiInputBase-root": { color: isExpanded ? "#9A9AAF" : "white", backgroundColor: isExpanded ? theme.palette.background.default : "transparent", height: "48px", borderRadius: "10px", }, }} inputProps={{ sx: { borderRadius: "10px", fontSize: "18px", lineHeight: "21px", py: 0, paddingLeft: switchState.length === 0 ? 0 : "18px" } }} /> setIsExpanded((prev) => !prev)}> {" "} {isExpanded ? : } {isExpanded ? <> : } checkedIcon={} />} label={""} sx={{ color: theme.palette.grey2.main, ml: "-9px", mr: 0, userSelect: "none", }} /> removeQuestion(totalIndex)}> } {isExpanded && ( {switchState.length === 0 ? : } ) } ) }