frontPanel/src/components/DescriptionForm/DescriptionForm.tsx

190 lines
6.1 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";
import { Box, IconButton, TextField, Typography } from "@mui/material";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
2023-04-23 08:39:34 +00:00
2023-04-15 09:10:59 +00:00
import CustomButton from "../CustomButton";
2023-04-23 08:39:34 +00:00
import SwitchAnswerOptions from "./SwitchAnswerOptions";
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";
import OneIcon from "@icons/questionsPage/OneIcon";
2023-04-23 08:39:34 +00:00
import DeleteIcon from "@icons/questionsPage/deleteIcon";
2023-04-15 09:10:59 +00:00
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={{
width: "796px",
height: "100%",
bgcolor: "#FFFFFF",
borderRadius: "12px",
}}
>
<Box sx={{ p: "0 20px", pt: "30px" }}>
<Box sx={{ width: "100%", maxWidth: "760px", display: "flex", alignItems: "center", gap: "10px", mb: "19px" }}>
<CustomTextField placeholder="Заголовок вопроса" text={""} />
<IconButton>
<ExpandMoreIcon />
</IconButton>
<OneIcon />
<PointsIcon />
</Box>
<Box sx={{ display: "flex" }}>
2023-04-23 08:39:34 +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" }}>
<Typography component={"h6"} sx={{ weight: "500", fontSize: "18px" }}>
Призыв к действию
</Typography>
<IconButton sx={{ borderRadius: "6px", padding: "2px" }}>
<DeleteIcon />
</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,
},
}}
/>
<CustomButton
onClick={() => setForwarding(true)}
variant="contained"
sx={{
display: forwarding ? "none" : "",
ml: "20px",
mb: "20px",
color: "#9A9AAF",
backgroundColor: "#F2F3F7",
width: "194px",
height: "48px",
border: "1px solid #9A9AAF",
}}
>
Переадрисация +
</CustomButton>
{forwarding ? (
<Box sx={{ ml: "20px", mt: "-36px" }}>
<Box sx={{ display: "flex", alignItems: "center", mb: "14xp" }}>
<Typography component={"h6"} sx={{ weight: "500", fontSize: "18px" }}>
Переадресация
</Typography>
<IconButton sx={{ borderRadius: "6px", padding: "2px" }}>
<DeleteIcon />
</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>
) : (
<CustomButton
variant="contained"
sx={{
mb: "20px",
color: "#9A9AAF",
backgroundColor: "#F2F3F7",
width: "119px",
height: "48px",
border: "1px solid #9A9AAF",
}}
>
Кнопка +
</CustomButton>
)}
</Box>
<ButtonsOptionsForm switchState={switchState} SSHC={SSHC} />
<SwitchAnswerOptions switchState={switchState} />
</Box>
);
2023-04-23 08:39:34 +00:00
};