2023-10-07 06:10:50 +00:00
|
|
|
|
import { Box, Button, IconButton, TextField, Typography, useMediaQuery, useTheme, Modal } from "@mui/material";
|
|
|
|
|
import {
|
|
|
|
|
sendContactForm,
|
|
|
|
|
setContactFormMailField,
|
|
|
|
|
setIsContactFormOpen,
|
|
|
|
|
useContactFormStore,
|
|
|
|
|
} from "../stores/contactForm";
|
|
|
|
|
import { enqueueSnackbar } from "notistack";
|
|
|
|
|
import X from "../assets/icons/x";
|
|
|
|
|
import PenaLogo from "../ui_kit/PenaLogo";
|
|
|
|
|
|
|
|
|
|
export default () => {
|
|
|
|
|
const theme = useTheme();
|
|
|
|
|
const isMobile = useMediaQuery(theme.breakpoints.down("md"));
|
|
|
|
|
|
|
|
|
|
const isModalOpen = useContactFormStore((state) => state.isModalOpen);
|
|
|
|
|
const isSubmitDisabled = useContactFormStore((state) => state.isSubmitDisabled);
|
|
|
|
|
const mail = useContactFormStore((state) => state.mail);
|
|
|
|
|
const upMd = useMediaQuery(theme.breakpoints.up("md"));
|
|
|
|
|
|
|
|
|
|
async function handleSendForm() {
|
|
|
|
|
const message = await sendContactForm();
|
|
|
|
|
|
|
|
|
|
if (message) enqueueSnackbar(message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Modal
|
|
|
|
|
disableScrollLock
|
|
|
|
|
open={isModalOpen}
|
|
|
|
|
onClose={() => setIsContactFormOpen(false)}
|
|
|
|
|
aria-labelledby="modal-modal-title"
|
|
|
|
|
aria-describedby="modal-modal-description"
|
|
|
|
|
>
|
|
|
|
|
<Box
|
|
|
|
|
component="form"
|
|
|
|
|
noValidate
|
|
|
|
|
sx={{
|
2023-10-23 17:27:04 +00:00
|
|
|
|
width: isMobile ? "90vw" : "600px",
|
2023-10-07 06:10:50 +00:00
|
|
|
|
height: "474px",
|
|
|
|
|
margin: "200px auto 0",
|
|
|
|
|
position: "relative",
|
|
|
|
|
backgroundColor: "white",
|
|
|
|
|
display: "flex",
|
|
|
|
|
alignItems: "center",
|
|
|
|
|
flexDirection: "column",
|
|
|
|
|
p: upMd ? "50px" : "18px",
|
|
|
|
|
pb: upMd ? "40px" : "30px",
|
|
|
|
|
gap: "15px",
|
|
|
|
|
borderRadius: "12px",
|
2023-10-07 09:20:35 +00:00
|
|
|
|
boxSizing: "border-box",
|
2023-10-07 06:10:50 +00:00
|
|
|
|
"& .MuiFormHelperText-root.Mui-error, & .MuiFormHelperText-root.Mui-error.MuiFormHelperText-filled":
|
|
|
|
|
{
|
|
|
|
|
position: "absolute",
|
|
|
|
|
top: "46px",
|
|
|
|
|
margin: "0",
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<IconButton
|
|
|
|
|
onClick={() => setIsContactFormOpen(false)}
|
|
|
|
|
sx={{
|
|
|
|
|
position: "absolute",
|
|
|
|
|
right: "7px",
|
|
|
|
|
top: "7px",
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<X/>
|
|
|
|
|
</IconButton>
|
|
|
|
|
<Box>
|
|
|
|
|
<PenaLogo width={upMd ? 233 : 196} />
|
|
|
|
|
</Box>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
2023-10-07 09:20:35 +00:00
|
|
|
|
mt: "0px",
|
|
|
|
|
mb: upMd ? "13px" : "33px",
|
2023-10-07 06:10:50 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Предрегистрация
|
|
|
|
|
</Typography>
|
2023-10-07 09:20:35 +00:00
|
|
|
|
<Typography
|
|
|
|
|
sx={{textAlign: "left",
|
|
|
|
|
width: "100%",
|
|
|
|
|
fontWeight: 500
|
|
|
|
|
}}
|
|
|
|
|
>E-mail</Typography>
|
2023-10-07 06:10:50 +00:00
|
|
|
|
<TextField
|
|
|
|
|
value={mail}
|
2023-11-29 15:45:15 +00:00
|
|
|
|
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setContactFormMailField(e.target.value)}
|
2023-10-07 09:20:35 +00:00
|
|
|
|
placeholder="username@penahaub.com"
|
2023-10-07 06:10:50 +00:00
|
|
|
|
name="name"
|
|
|
|
|
fullWidth
|
|
|
|
|
sx={{
|
2023-10-23 17:27:04 +00:00
|
|
|
|
width: "100%",
|
2023-10-07 09:20:35 +00:00
|
|
|
|
// mt: "25px",
|
2023-10-07 06:10:50 +00:00
|
|
|
|
mb: "10px",
|
|
|
|
|
"& .MuiInputBase-root": {
|
|
|
|
|
backgroundColor: "#F2F3F7",
|
|
|
|
|
height: "45px",
|
|
|
|
|
borderRadius: "10px",
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
inputProps={{
|
|
|
|
|
sx: {
|
|
|
|
|
borderRadius: "10px",
|
|
|
|
|
fontSize: "18px",
|
|
|
|
|
lineHeight: "21px",
|
|
|
|
|
py: 0,
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<Button
|
2023-10-07 09:20:35 +00:00
|
|
|
|
variant='contained'
|
2023-10-07 06:10:50 +00:00
|
|
|
|
fullWidth
|
|
|
|
|
onClick={handleSendForm}
|
|
|
|
|
sx={{
|
|
|
|
|
py: "12px",
|
|
|
|
|
"&:hover": {
|
|
|
|
|
},
|
|
|
|
|
"&:active": {
|
|
|
|
|
color: "white",
|
|
|
|
|
backgroundColor: "black",
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Отправить
|
|
|
|
|
</Button>
|
|
|
|
|
<Typography
|
|
|
|
|
sx={{
|
2023-10-07 09:20:35 +00:00
|
|
|
|
mt: "16px",
|
2023-10-07 06:10:50 +00:00
|
|
|
|
mb: upMd ? "10px" : "33px",
|
2023-10-07 09:20:35 +00:00
|
|
|
|
textAlign: "center",
|
|
|
|
|
maxWidth: "440px"
|
2023-10-07 06:10:50 +00:00
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
После запуска продукта вам придет сообщение
|
|
|
|
|
на указанную электронную почту
|
|
|
|
|
</Typography>
|
|
|
|
|
</Box>
|
|
|
|
|
</Modal>
|
|
|
|
|
);
|
|
|
|
|
};
|