frontPanel/src/pages/Result/DescriptionForm/ButtinsOptionsForm.tsx

112 lines
2.9 KiB
TypeScript
Raw Normal View History

2023-04-15 09:10:59 +00:00
import React from "react";
2023-10-16 14:34:12 +00:00
import { Box, IconButton, useTheme, useMediaQuery } from "@mui/material";
2023-04-23 08:39:34 +00:00
import MiniButtonSetting from "@ui_kit/MiniButtonSetting";
import SettingIcon from "@icons/questionsPage/settingIcon";
import Branching from "@icons/questionsPage/branching";
2023-09-25 13:43:15 +00:00
import { HideIcon } from "@icons/questionsPage/hideIcon";
import { CopyIcon } from "@icons/questionsPage/CopyIcon";
import { DeleteIcon } from "@icons/questionsPage/deleteIcon";
2023-04-15 09:10:59 +00:00
import StarIconPoints from "./StarIconsPoints";
interface Props {
switchState: string;
SSHC: (data: string) => void;
}
export default function ButtonsOptionsForm({ SSHC, switchState }: Props) {
const theme = useTheme();
2023-10-16 14:34:12 +00:00
const isTablet = useMediaQuery(theme.breakpoints.down(800));
2023-04-23 08:39:34 +00:00
2023-04-15 09:10:59 +00:00
const buttonSetting: { icon: JSX.Element; title: string; value: string }[] = [
{
2023-10-16 14:34:12 +00:00
icon: (
<SettingIcon
color={
switchState === "setting" ? "#ffffff" : theme.palette.grey3.main
}
/>
),
2023-04-15 09:10:59 +00:00
title: "Настройки",
value: "setting",
},
{
2023-10-16 14:34:12 +00:00
icon: (
<Branching
color={
switchState === "branching" ? "#ffffff" : theme.palette.grey3.main
}
/>
),
2023-04-15 09:10:59 +00:00
title: "Ветвление",
value: "branching",
},
{
2023-10-16 14:34:12 +00:00
icon: (
<StarIconPoints
color={
switchState === "points" ? "#ffffff" : theme.palette.grey3.main
}
/>
),
2023-04-15 09:10:59 +00:00
title: "Баллы",
value: "points",
},
];
return (
<Box
sx={{
display: "flex",
justifyContent: "space-between",
width: "100%",
background: "#F2F3F7",
}}
>
<Box
sx={{
padding: "20px",
display: "flex",
2023-10-16 14:34:12 +00:00
flexWrap: "wrap",
2023-04-15 09:10:59 +00:00
gap: "10px",
}}
>
2023-04-23 08:39:34 +00:00
{buttonSetting.map(({ icon, title, value }, index) => (
2023-04-15 09:10:59 +00:00
<MiniButtonSetting
2023-04-23 08:39:34 +00:00
key={index}
2023-04-15 09:10:59 +00:00
onClick={() => {
2023-04-23 08:39:34 +00:00
SSHC(value);
2023-04-15 09:10:59 +00:00
}}
sx={{
2023-10-16 14:34:12 +00:00
backgroundColor:
switchState === value
? theme.palette.brightPurple.main
: "transparent",
color:
switchState === value ? "#ffffff" : theme.palette.grey3.main,
2023-04-15 09:10:59 +00:00
}}
>
2023-04-23 08:39:34 +00:00
{icon}
2023-10-16 14:34:12 +00:00
{!isTablet && title}
2023-04-15 09:10:59 +00:00
</MiniButtonSetting>
))}
</Box>
<Box
sx={{
padding: "20px",
2023-10-16 14:34:12 +00:00
display: "flex",
2023-04-15 09:10:59 +00:00
}}
>
<IconButton sx={{ borderRadius: "6px", padding: "2px" }}>
2023-09-25 13:43:15 +00:00
<HideIcon style={{ color: "#4D4D4D" }} />
2023-04-15 09:10:59 +00:00
</IconButton>
<IconButton sx={{ borderRadius: "6px", padding: "2px" }}>
2023-09-25 13:43:15 +00:00
<CopyIcon style={{ color: "#4D4D4D" }} />
2023-04-15 09:10:59 +00:00
</IconButton>
<IconButton sx={{ borderRadius: "6px", padding: "2px" }}>
2023-09-25 13:43:15 +00:00
<DeleteIcon style={{ color: "#4D4D4D" }} />
2023-04-15 09:10:59 +00:00
</IconButton>
</Box>
</Box>
);
}