76 lines
2.3 KiB
TypeScript
76 lines
2.3 KiB
TypeScript
import { Box, Link, Typography, useTheme } from "@mui/material";
|
||
import EnterIcon from "../../../assets/icons/questionsPage/enterIcon";
|
||
import ButtonsOptions from "../ButtonsOptions";
|
||
import SwitchEmoji from "./switchEmoji";
|
||
import React from "react";
|
||
import AddEmoji from "../../../assets/icons/questionsPage/addEmoji";
|
||
import { AnswerDraggableList } from "../AnswerDraggableList";
|
||
import { questionStore, updateQuestionsList } from "@root/questions";
|
||
|
||
interface Props {
|
||
totalIndex: number;
|
||
}
|
||
export default function Emoji({ totalIndex }: Props) {
|
||
const [switchState, setSwitchState] = React.useState("setting");
|
||
const { listQuestions } = questionStore();
|
||
const theme = useTheme();
|
||
|
||
const SSHC = (data: string) => {
|
||
setSwitchState(data);
|
||
};
|
||
|
||
return (
|
||
<>
|
||
<Box sx={{ padding: "20px" }}>
|
||
<AnswerDraggableList
|
||
variants={listQuestions[totalIndex].content.variants}
|
||
totalIndex={totalIndex}
|
||
icon={
|
||
<Box sx={{ margin: "0 15px 0 5px" }}>
|
||
<AddEmoji />
|
||
</Box>
|
||
}
|
||
/>
|
||
<Box sx={{ display: "flex", alignItems: "center", gap: "10px" }}>
|
||
<Link
|
||
component="button"
|
||
variant="body2"
|
||
sx={{ color: theme.palette.brightPurple.main }}
|
||
onClick={() => {
|
||
const answerNew =
|
||
listQuestions[totalIndex].content.variants.slice();
|
||
answerNew.push({ answer: "", answerLong: "", hints: "" });
|
||
|
||
updateQuestionsList(totalIndex, {
|
||
content: {
|
||
...listQuestions[totalIndex].content,
|
||
variants: answerNew,
|
||
},
|
||
});
|
||
}}
|
||
>
|
||
Добавьте ответ
|
||
</Link>
|
||
<Typography
|
||
sx={{
|
||
fontWeight: 400,
|
||
fontSize: "18px",
|
||
lineHeight: "21.33px",
|
||
color: theme.palette.grey2.main,
|
||
}}
|
||
>
|
||
или нажмите Enter
|
||
</Typography>
|
||
<EnterIcon />
|
||
</Box>
|
||
</Box>
|
||
<ButtonsOptions
|
||
switchState={switchState}
|
||
SSHC={SSHC}
|
||
totalIndex={totalIndex}
|
||
/>
|
||
<SwitchEmoji switchState={switchState} totalIndex={totalIndex} />
|
||
</>
|
||
);
|
||
}
|