2023-04-23 08:39:34 +00:00
|
|
|
|
import { useState } from "react";
|
2023-10-16 14:23:44 +00:00
|
|
|
|
import {
|
|
|
|
|
Box,
|
|
|
|
|
Button,
|
|
|
|
|
IconButton,
|
|
|
|
|
SxProps,
|
|
|
|
|
Theme,
|
|
|
|
|
Typography,
|
|
|
|
|
useTheme,
|
|
|
|
|
useMediaQuery,
|
|
|
|
|
} from "@mui/material";
|
2023-05-07 14:01:03 +00:00
|
|
|
|
import { SwitchSetting } from "./SwichResult";
|
2023-04-23 08:39:34 +00:00
|
|
|
|
|
|
|
|
|
import Info from "@icons/Info";
|
2023-04-15 09:10:59 +00:00
|
|
|
|
|
2023-05-03 19:21:00 +00:00
|
|
|
|
import listChecks from "@icons/listChecks.svg";
|
|
|
|
|
import ShareNetwork from "@icons/ShareNetwork.svg";
|
|
|
|
|
import ArrowCounterClockWise from "@icons/ArrowCounterClockWise.svg";
|
2023-04-15 09:10:59 +00:00
|
|
|
|
|
|
|
|
|
const buttonSetting: { title: string; sx: SxProps<Theme>; type: string }[] = [
|
|
|
|
|
{
|
2023-10-16 14:23:44 +00:00
|
|
|
|
sx: {
|
|
|
|
|
backgroundColor: "#7E2AEA",
|
|
|
|
|
color: "white",
|
|
|
|
|
width: "237px",
|
|
|
|
|
height: "44px",
|
|
|
|
|
border: "1px solid #9A9AAF",
|
|
|
|
|
},
|
2023-04-15 09:10:59 +00:00
|
|
|
|
title: "До формы контактов",
|
|
|
|
|
type: "toContactForm",
|
|
|
|
|
},
|
|
|
|
|
{
|
2023-10-16 14:23:44 +00:00
|
|
|
|
sx: {
|
|
|
|
|
backgroundColor: "#F2F3F7",
|
|
|
|
|
color: "#9A9AAF",
|
|
|
|
|
width: "266px",
|
|
|
|
|
height: "44px",
|
|
|
|
|
border: "1px solid #9A9AAF",
|
|
|
|
|
},
|
2023-04-15 09:10:59 +00:00
|
|
|
|
title: "После формы контактов",
|
|
|
|
|
type: "afterСontactForm",
|
|
|
|
|
},
|
|
|
|
|
{
|
2023-10-16 14:23:44 +00:00
|
|
|
|
sx: {
|
|
|
|
|
color: "#9A9AAF",
|
|
|
|
|
backgroundColor: "#F2F3F7",
|
|
|
|
|
width: "233px",
|
|
|
|
|
height: "44px",
|
|
|
|
|
border: "1px solid #9A9AAF",
|
|
|
|
|
},
|
2023-04-15 09:10:59 +00:00
|
|
|
|
title: "Отправить на E-mail",
|
|
|
|
|
type: "e-mail",
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
2023-04-23 08:39:34 +00:00
|
|
|
|
export const SettingForm = () => {
|
2023-05-03 23:25:35 +00:00
|
|
|
|
const [activeIndex, setActiveIndex] = useState<number>(0);
|
|
|
|
|
const [typeActive, setTypeActive] = useState<string>("toContactForm");
|
2023-10-16 14:23:44 +00:00
|
|
|
|
const theme = useTheme();
|
|
|
|
|
const isSmallMonitor = useMediaQuery(theme.breakpoints.down(1100));
|
2023-04-15 09:10:59 +00:00
|
|
|
|
|
|
|
|
|
const active = (index: number, type: string) => {
|
|
|
|
|
setActiveIndex(index);
|
|
|
|
|
setTypeActive(type);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
2023-10-16 14:23:44 +00:00
|
|
|
|
<Box component="section" sx={{ maxWidth: "796px" }}>
|
2023-04-15 09:10:59 +00:00
|
|
|
|
<Box sx={{ display: "flex", alignItems: "center", mb: "40px" }}>
|
|
|
|
|
<Typography sx={{ pr: "10px" }} variant="h5">
|
|
|
|
|
Настройки результатов
|
|
|
|
|
</Typography>
|
|
|
|
|
<Info />
|
|
|
|
|
</Box>
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
height: "100%",
|
|
|
|
|
bgcolor: "#FFFFFF",
|
|
|
|
|
borderRadius: "12px",
|
|
|
|
|
p: "30px 20px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
justifyContent: "space-between",
|
|
|
|
|
mb: "20px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
2023-04-23 08:39:34 +00:00
|
|
|
|
<Typography component="p" sx={{ color: "#9A9AAF" }}>
|
|
|
|
|
Показывать результат
|
|
|
|
|
</Typography>
|
2023-04-15 09:10:59 +00:00
|
|
|
|
<IconButton>
|
2023-10-16 14:23:44 +00:00
|
|
|
|
<svg
|
|
|
|
|
width="30"
|
|
|
|
|
height="30"
|
|
|
|
|
viewBox="0 0 30 30"
|
|
|
|
|
fill="none"
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
>
|
2023-04-15 09:10:59 +00:00
|
|
|
|
<rect width="30" height="30" rx="6" fill="#EEE4FC" />
|
|
|
|
|
<path
|
|
|
|
|
d="M22.5 11.25L15 18.75L7.5 11.25"
|
|
|
|
|
stroke="#7E2AEA"
|
2023-05-03 19:21:00 +00:00
|
|
|
|
strokeWidth="1.5"
|
|
|
|
|
strokeLinecap="round"
|
|
|
|
|
strokeLinejoin="round"
|
2023-04-15 09:10:59 +00:00
|
|
|
|
/>
|
|
|
|
|
</svg>
|
|
|
|
|
</IconButton>
|
|
|
|
|
</Box>
|
2023-10-16 14:23:44 +00:00
|
|
|
|
<Box
|
|
|
|
|
sx={{
|
|
|
|
|
display: "flex",
|
|
|
|
|
flexDirection: isSmallMonitor ? "column" : "row",
|
|
|
|
|
justifyContent: "space-between",
|
|
|
|
|
gap: "20px",
|
|
|
|
|
mb: "20px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
2023-04-15 09:10:59 +00:00
|
|
|
|
{buttonSetting.map(({ sx, title, type }, index) => (
|
2023-05-10 17:35:30 +00:00
|
|
|
|
<Button
|
2023-04-15 09:10:59 +00:00
|
|
|
|
disableRipple
|
|
|
|
|
onClick={() => active(index, type)}
|
|
|
|
|
key={title}
|
|
|
|
|
sx={{
|
|
|
|
|
...sx,
|
|
|
|
|
bgcolor: activeIndex === index ? " #7E2AEA" : "#F2F3F7",
|
|
|
|
|
color: activeIndex === index ? " white" : "#9A9AAF",
|
2023-10-16 14:23:44 +00:00
|
|
|
|
minWidth: isSmallMonitor ? "300px" : "auto",
|
2023-04-15 09:10:59 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{title}
|
2023-05-10 17:35:30 +00:00
|
|
|
|
</Button>
|
2023-04-15 09:10:59 +00:00
|
|
|
|
))}
|
|
|
|
|
</Box>
|
|
|
|
|
{typeActive === "e-mail" ? (
|
2023-10-16 14:23:44 +00:00
|
|
|
|
<SwitchSetting
|
|
|
|
|
icon={listChecks}
|
|
|
|
|
text="Показывать несколько результатов"
|
|
|
|
|
/>
|
2023-04-15 09:10:59 +00:00
|
|
|
|
) : (
|
|
|
|
|
<>
|
2023-10-16 14:23:44 +00:00
|
|
|
|
<SwitchSetting
|
|
|
|
|
icon={listChecks}
|
|
|
|
|
text="Показывать несколько результатов"
|
|
|
|
|
/>
|
2023-04-23 08:39:34 +00:00
|
|
|
|
<SwitchSetting icon={ShareNetwork} text="Поделиться результатами" />
|
2023-10-16 14:23:44 +00:00
|
|
|
|
<SwitchSetting
|
|
|
|
|
icon={ArrowCounterClockWise}
|
|
|
|
|
text="Кнопка `Пройти тест заново`"
|
|
|
|
|
/>
|
2023-04-15 09:10:59 +00:00
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</Box>
|
2023-10-16 14:23:44 +00:00
|
|
|
|
<Box
|
|
|
|
|
sx={{ display: "flex", alignItems: "center", mb: "15px", mt: "15px" }}
|
|
|
|
|
>
|
2023-04-15 09:10:59 +00:00
|
|
|
|
<Typography variant="p1" sx={{ color: "#4D4D4D", fontSize: "14px" }}>
|
|
|
|
|
Создайте результат
|
|
|
|
|
</Typography>
|
|
|
|
|
<Button
|
|
|
|
|
disableRipple
|
|
|
|
|
sx={{
|
|
|
|
|
ml: "auto",
|
|
|
|
|
height: "19px",
|
|
|
|
|
color: "#7E2AEA",
|
|
|
|
|
textDecoration: "underline",
|
|
|
|
|
fontSize: "16px",
|
|
|
|
|
|
|
|
|
|
"&:hover": {
|
|
|
|
|
background: "none",
|
|
|
|
|
textDecoration: "underline",
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
variant="text"
|
|
|
|
|
>
|
|
|
|
|
Свернуть всё
|
|
|
|
|
</Button>
|
|
|
|
|
</Box>
|
|
|
|
|
</Box>
|
|
|
|
|
);
|
2023-04-23 08:39:34 +00:00
|
|
|
|
};
|