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

189 lines
6.0 KiB
TypeScript
Raw Normal View History

2023-04-23 08:39:34 +00:00
import React from "react";
2023-04-15 09:10:59 +00:00
import { useState } from "react";
2023-08-24 20:53:27 +00:00
import { Box, Button, IconButton, TextField, Typography } from "@mui/material";
2023-04-15 09:10:59 +00:00
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
import SwitchResult from "./SwitchResult";
2023-04-23 08:39:34 +00:00
import ButtonsOptionsForm from "./ButtinsOptionsForm";
2023-04-15 09:10:59 +00:00
import PriceButtons from "./PriceButton";
import DiscountButtons from "./DiscountButtons";
import CustomTextField from "@ui_kit/CustomTextField";
2023-09-25 13:43:15 +00:00
import { OneIcon } from "@icons/questionsPage/OneIcon";
import { DeleteIcon } from "@icons/questionsPage/deleteIcon";
import { PointsIcon } from "@icons/questionsPage/PointsIcon";
import Info from "@icons/Info";
2023-04-23 08:39:34 +00:00
import ImageAndVideoButtons from "./ImageAndVideoButtons";
export const DescriptionForm = () => {
const [switchState, setSwitchState] = useState<string>("");
2023-04-15 09:10:59 +00:00
const [priceButtonsActive, setPriceButtonsActive] = useState<number>(0);
const [priceButtonsType, setPriceButtonsType] = useState<string>();
const [forwarding, setForwarding] = useState<boolean>(false);
2023-04-23 08:39:34 +00:00
const buttonsActive = (index: number, type: string) => {
2023-04-15 09:10:59 +00:00
setPriceButtonsActive(index);
setPriceButtonsType(type);
};
const SSHC = (data: string) => {
setSwitchState(data);
};
return (
<Box
sx={{
2023-10-16 14:23:44 +00:00
maxWidth: "796px",
2023-04-15 09:10:59 +00:00
height: "100%",
bgcolor: "#FFFFFF",
borderRadius: "12px",
}}
>
<Box sx={{ p: "0 20px", pt: "30px" }}>
2023-08-24 20:53:27 +00:00
<Box
sx={{
width: "100%",
maxWidth: "760px",
display: "flex",
alignItems: "center",
gap: "10px",
mb: "19px",
}}
>
2023-04-15 09:10:59 +00:00
<CustomTextField placeholder="Заголовок вопроса" text={""} />
<IconButton>
<ExpandMoreIcon />
</IconButton>
<OneIcon />
2023-09-25 13:43:15 +00:00
<PointsIcon style={{ color: "#9A9AAF" }} />
2023-04-15 09:10:59 +00:00
</Box>
<Box sx={{ display: "flex" }}>
2023-10-16 14:23:44 +00:00
<PriceButtons
ButtonsActive={buttonsActive}
priceButtonsActive={priceButtonsActive}
/>
2023-04-15 09:10:59 +00:00
<DiscountButtons />
</Box>
<TextField
fullWidth
placeholder="Описание"
sx={{
"& .MuiInputBase-root": {
backgroundColor: "#F2F3F7",
width: "100%",
height: "110px",
borderRadius: "10px",
},
}}
inputProps={{
sx: {
borderRadius: "10px",
fontSize: "18px",
lineHeight: "21px",
py: 0,
},
}}
/>
<ImageAndVideoButtons />
{priceButtonsType === "smooth" ? (
<Box sx={{ mb: "20px" }}>
<Box sx={{ display: "flex", alignItems: "center", mb: "14xp" }}>
2023-10-16 14:23:44 +00:00
<Typography
component={"h6"}
sx={{ weight: "500", fontSize: "18px" }}
>
2023-04-15 09:10:59 +00:00
Призыв к действию
</Typography>
<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 sx={{ display: "flex" }}>
<TextField
placeholder="Узнать подробнее"
fullWidth
sx={{
width: "410px",
"& .MuiInputBase-root": {
backgroundColor: "#F2F3F7",
width: "410px",
height: "48px",
borderRadius: "10px",
},
}}
inputProps={{
sx: {
borderRadius: "10px",
fontSize: "18px",
lineHeight: "21px",
py: 0,
},
}}
/>
<Button
2023-04-15 09:10:59 +00:00
onClick={() => setForwarding(true)}
variant="outlined"
2023-04-15 09:10:59 +00:00
sx={{
display: forwarding ? "none" : "",
ml: "20px",
mb: "20px",
}}
>
Переадресация +
</Button>
2023-04-15 09:10:59 +00:00
{forwarding ? (
<Box sx={{ ml: "20px", mt: "-36px" }}>
2023-10-16 14:23:44 +00:00
<Box
sx={{ display: "flex", alignItems: "center", mb: "14xp" }}
>
<Typography
component={"h6"}
sx={{ weight: "500", fontSize: "18px" }}
>
2023-04-15 09:10:59 +00:00
Переадресация
</Typography>
<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>
<Info />
</Box>
<Box>
<TextField
placeholder="https://exemple.ru"
fullWidth
sx={{
"& .MuiInputBase-root": {
backgroundColor: "#F2F3F7",
width: "326px",
height: "48px",
borderRadius: "10px",
},
}}
inputProps={{
sx: {
borderRadius: "10px",
fontSize: "18px",
lineHeight: "21px",
py: 0,
},
}}
/>
</Box>
</Box>
) : (
2023-04-23 08:39:34 +00:00
<React.Fragment />
2023-04-15 09:10:59 +00:00
)}
</Box>
</Box>
) : (
2023-08-24 20:53:27 +00:00
<Button variant="outlined" sx={{ mb: "20px" }}>
2023-04-15 09:10:59 +00:00
Кнопка +
</Button>
2023-04-15 09:10:59 +00:00
)}
</Box>
<ButtonsOptionsForm switchState={switchState} SSHC={SSHC} />
2023-08-24 20:53:27 +00:00
<SwitchResult switchState={switchState} totalIndex={0} />
2023-04-15 09:10:59 +00:00
</Box>
);
2023-04-23 08:39:34 +00:00
};