frontPanel/src/pages/Questions/ButtonsOptions.tsx

86 lines
2.4 KiB
TypeScript
Raw Normal View History

import MiniButtonSetting from "@ui_kit/MiniButtonSetting";
import React from "react";
import SettingIcon from "@icons/questionsPage/settingIcon";
import Clue from "@icons/questionsPage/clue";
import Branching from "@icons/questionsPage/branching";
2023-04-15 09:10:59 +00:00
import { Box, IconButton, useTheme } from "@mui/material";
import HideIcon from "@icons/questionsPage/hideIcon";
import CopyIcon from "@icons/questionsPage/CopyIcon";
import DeleteIcon from "@icons/questionsPage/deleteIcon";
interface Props {
2023-04-15 09:10:59 +00:00
switchState: string;
SSHC: (data: string) => void;
}
2023-04-15 09:10:59 +00:00
export default function ButtonsOptions({ SSHC, switchState }: Props) {
const theme = useTheme();
const buttonSetting: { icon: JSX.Element; title: string; value: string }[] = [
{
icon: <SettingIcon color={switchState === "setting" ? "#ffffff" : theme.palette.grey3.main} />,
title: "Настройки",
value: "setting",
},
{
icon: <Clue color={switchState === "help" ? "#ffffff" : theme.palette.grey3.main} />,
title: "Подсказка",
value: "help",
},
{
icon: <Branching color={switchState === "branching" ? "#ffffff" : theme.palette.grey3.main} />,
title: "Ветвление",
value: "branching",
},
];
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",
}}
>
2023-04-23 08:39:34 +00:00
{buttonSetting.map(({ icon, title, value }) => (
2023-04-15 09:10:59 +00:00
<MiniButtonSetting
2023-04-23 08:39:34 +00:00
key={title}
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-04-23 08:39:34 +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}
{title}
2023-04-15 09:10:59 +00:00
</MiniButtonSetting>
))}
</Box>
<Box
sx={{
padding: "20px",
}}
>
<IconButton sx={{ borderRadius: "6px", padding: "2px" }}>
<HideIcon />
</IconButton>
<IconButton sx={{ borderRadius: "6px", padding: "2px" }}>
<CopyIcon />
</IconButton>
<IconButton sx={{ borderRadius: "6px", padding: "2px" }}>
<DeleteIcon />
</IconButton>
</Box>
</Box>
);
}