frontPanel/src/pages/Questions/ButtonsOptionsAndPict.tsx

192 lines
5.5 KiB
TypeScript
Raw Normal View History

import MiniButtonSetting from "@ui_kit/MiniButtonSetting";
import React from "react";
import SettingIcon from "../../assets/icons/questionsPage/settingIcon";
import Clue from "../../assets/icons/questionsPage/clue";
import Branching from "../../assets/icons/questionsPage/branching";
2023-08-16 13:29:28 +00:00
import { Box, IconButton, Tooltip, Typography, useTheme } from "@mui/material";
import HideIcon from "../../assets/icons/questionsPage/hideIcon";
import CopyIcon from "../../assets/icons/questionsPage/CopyIcon";
import DeleteIcon from "../../assets/icons/questionsPage/deleteIcon";
import ImgIcon from "../../assets/icons/questionsPage/imgIcon";
2023-08-16 13:29:28 +00:00
import { useParams } from "react-router-dom";
import { questionStore, removeQuestion, resetSomeField } from "@root/questions";
import "./ButtonsOptionsAndPict.css";
interface Props {
2023-04-15 09:10:59 +00:00
switchState: string;
SSHC: (data: string) => void;
2023-08-16 13:29:28 +00:00
totalIndex: number;
}
2023-08-16 13:29:28 +00:00
export default function ButtonsOptionsAndPict({
SSHC,
switchState,
totalIndex,
}: Props) {
const params = Number(useParams().quizId);
2023-08-16 13:29:28 +00:00
const { openedModalSettings } = questionStore();
2023-04-15 09:10:59 +00:00
const theme = useTheme();
2023-08-16 13:29:28 +00:00
const openedModal = () => {
resetSomeField({ openedModalSettings: "open" });
};
2023-04-15 09:10:59 +00:00
return (
<Box
sx={{
display: "flex",
justifyContent: "space-between",
width: "100%",
background: "#f2f3f7",
}}
>
<Box
sx={{
padding: "20px",
display: "flex",
gap: "10px",
}}
>
<MiniButtonSetting
onClick={() => {
SSHC("setting");
}}
sx={{
2023-08-16 13:29:28 +00:00
backgroundColor:
switchState === "setting"
? theme.palette.brightPurple.main
: "transparent",
color:
switchState === "setting" ? "#ffffff" : theme.palette.grey3.main,
2023-04-15 09:10:59 +00:00
}}
>
2023-08-16 13:29:28 +00:00
<SettingIcon
color={
switchState === "setting" ? "#ffffff" : theme.palette.grey3.main
}
/>
2023-04-15 09:10:59 +00:00
Настройки
</MiniButtonSetting>
<MiniButtonSetting
onClick={() => {
SSHC("help");
}}
sx={{
2023-08-16 13:29:28 +00:00
backgroundColor:
switchState === "help"
? theme.palette.brightPurple.main
: "transparent",
color:
switchState === "help" ? "#ffffff" : theme.palette.grey3.main,
2023-04-15 09:10:59 +00:00
}}
>
2023-08-16 13:29:28 +00:00
<Clue
color={
switchState === "help" ? "#ffffff" : theme.palette.grey3.main
}
/>
2023-04-15 09:10:59 +00:00
Помощь
</MiniButtonSetting>
2023-08-16 13:29:28 +00:00
<Tooltip
arrow
placement="right"
title={
<Box>
<Typography
sx={{
color: "#4D4D4D",
fontWeight: "bold",
fontSize: "14px",
marginBottom: "10px",
}}
>
Будет показан при условии
</Typography>
<Typography sx={{ fontWeight: "bold", fontSize: "12px" }}>
Название
</Typography>
<Typography
sx={{
fontWeight: "bold",
fontSize: "12px",
marginBottom: "10px",
}}
>
Условие 1, Условие 2
</Typography>
<Typography sx={{ color: "#7E2AEA", fontSize: "12px" }}>
Все условия обязательны
</Typography>
</Box>
}
2023-04-15 09:10:59 +00:00
>
2023-08-16 13:29:28 +00:00
<MiniButtonSetting
onClick={() => {
SSHC("branching");
openedModal();
}}
sx={{
backgroundColor:
switchState === "branching"
? theme.palette.brightPurple.main
: "transparent",
color:
switchState === "branching"
? "#ffffff"
: theme.palette.grey3.main,
}}
>
<Branching
color={
switchState === "branching"
? "#ffffff"
: theme.palette.grey3.main
}
/>
Ветвление
</MiniButtonSetting>
</Tooltip>
2023-04-15 09:10:59 +00:00
<MiniButtonSetting
onClick={() => {
SSHC("image");
}}
sx={{
2023-08-16 13:29:28 +00:00
backgroundColor:
switchState === "image"
? theme.palette.brightPurple.main
: "transparent",
color:
switchState === "image" ? "#ffffff" : theme.palette.grey3.main,
2023-04-15 09:10:59 +00:00
}}
>
2023-08-16 13:29:28 +00:00
<ImgIcon
color={
switchState === "image" ? "#ffffff" : theme.palette.grey3.main
}
/>
2023-04-15 09:10:59 +00:00
Изображение
</MiniButtonSetting>
</Box>
<Box
sx={{
padding: "20px",
}}
>
<IconButton sx={{ borderRadius: "6px", padding: "2px" }}>
2023-08-16 13:29:28 +00:00
<HideIcon color={"#4D4D4D"} />
2023-04-15 09:10:59 +00:00
</IconButton>
<IconButton sx={{ borderRadius: "6px", padding: "2px" }}>
2023-08-16 13:29:28 +00:00
<CopyIcon color={"#4D4D4D"} />
2023-04-15 09:10:59 +00:00
</IconButton>
2023-08-16 13:29:28 +00:00
<IconButton
sx={{ borderRadius: "6px", padding: "2px" }}
onClick={() => removeQuestion(totalIndex)}
>
<DeleteIcon color={"#4D4D4D"} />
2023-04-15 09:10:59 +00:00
</IconButton>
</Box>
</Box>
);
}