fix: answer icons

This commit is contained in:
IlyaDoronin 2023-10-13 13:52:29 +03:00
parent 76186f6a7b
commit 9eea74c18e
2 changed files with 21 additions and 62 deletions

@ -59,91 +59,46 @@ interface Props {
isDragging: boolean; isDragging: boolean;
} }
const IconAndrom = (isExpanded: boolean, switchState: string) => { const IconAndrom = (switchState: string) => {
switch (switchState) { switch (switchState) {
case "variant": case "variant":
return ( return <Answer color="#9A9AAF" sx={{ height: "22px", width: "20px" }} />;
<Answer
color={isExpanded ? "#9A9AAF" : "#7E2AEA"}
sx={{ height: "22px", width: "20px" }}
/>
);
case "images": case "images":
return ( return (
<OptionsPict <OptionsPict color="#9A9AAF" sx={{ height: "22px", width: "20px" }} />
color={isExpanded ? "#9A9AAF" : "#7E2AEA"}
sx={{ height: "22px", width: "20px" }}
/>
); );
case "varimg": case "varimg":
return ( return (
<OptionsAndPict <OptionsAndPict
color={isExpanded ? "#9A9AAF" : "#7E2AEA"} color="#9A9AAF"
sx={{ height: "22px", width: "20px" }} sx={{ height: "22px", width: "20px" }}
/> />
); );
case "emoji": case "emoji":
return ( return <Emoji color="#9A9AAF" sx={{ height: "22px", width: "20px" }} />;
<Emoji
color={isExpanded ? "#9A9AAF" : "#7E2AEA"}
sx={{ height: "22px", width: "20px" }}
/>
);
case "text": case "text":
return ( return <Input color="#9A9AAF" sx={{ height: "22px", width: "20px" }} />;
<Input
color={isExpanded ? "#9A9AAF" : "#7E2AEA"}
sx={{ height: "22px", width: "20px" }}
/>
);
case "select": case "select":
return ( return (
<DropDown <DropDown color="#9A9AAF" sx={{ height: "22px", width: "20px" }} />
color={isExpanded ? "#9A9AAF" : "#7E2AEA"}
sx={{ height: "22px", width: "20px" }}
/>
); );
case "date": case "date":
return ( return <Date color="#9A9AAF" sx={{ height: "22px", width: "20px" }} />;
<Date
color={isExpanded ? "#9A9AAF" : "#7E2AEA"}
sx={{ height: "22px", width: "20px" }}
/>
);
case "number": case "number":
return ( return <Slider color="#9A9AAF" sx={{ height: "22px", width: "20px" }} />;
<Slider
color={isExpanded ? "#9A9AAF" : "#7E2AEA"}
sx={{ height: "22px", width: "20px" }}
/>
);
case "file": case "file":
return ( return (
<Download <Download color="#9A9AAF" sx={{ height: "22px", width: "20px" }} />
color={isExpanded ? "#9A9AAF" : "#7E2AEA"}
sx={{ height: "22px", width: "20px" }}
/>
); );
case "page": case "page":
return ( return <Page color="#9A9AAF" sx={{ height: "22px", width: "20px" }} />;
<Page
color={isExpanded ? "#9A9AAF" : "#7E2AEA"}
sx={{ height: "22px", width: "20px" }}
/>
);
case "rating": case "rating":
return ( return (
<RatingIcon <RatingIcon color="#9A9AAF" sx={{ height: "22px", width: "20px" }} />
color={isExpanded ? "#9A9AAF" : "#7E2AEA"}
sx={{ height: "22px", width: "20px" }}
/>
); );
default: default:
return ( return (
<AnswerGroup <AnswerGroup color="#9A9AAF" sx={{ height: "22px", width: "20px" }} />
color={isExpanded ? "#9A9AAF" : "#7E2AEA"}
sx={{ height: "22px", width: "20px" }}
/>
); );
} }
}; };
@ -209,7 +164,7 @@ export default function QuestionsPageCard({
sx={{ cursor: "pointer" }} sx={{ cursor: "pointer" }}
onClick={() => setOpen((isOpened) => !isOpened)} onClick={() => setOpen((isOpened) => !isOpened)}
> >
{IconAndrom(question.expanded, question.type)} {IconAndrom(question.type)}
</InputAdornment> </InputAdornment>
<ChooseAnswerModal <ChooseAnswerModal
open={open} open={open}

@ -92,9 +92,13 @@ export default function FormQuestionsPage() {
}} }}
onClick={() => { onClick={() => {
createQuestion(quizId); createQuestion(quizId);
updateQuestionsList<QuizQuestionBase>(quizId, 0, { updateQuestionsList<QuizQuestionBase>(
expanded: true, quizId,
}); listQuestions[quizId].length - 1 || 0,
{
expanded: true,
}
);
}} }}
> >
<AddAnswer color="#EEE4FC" /> <AddAnswer color="#EEE4FC" />