окошко спасиб за заявку

This commit is contained in:
Nastya 2024-08-18 14:33:14 +03:00
parent 6945cf857f
commit 1d1fb02ca7

@ -8,6 +8,7 @@ import { sendContactFormRequest } from "@/api/tariff"
import { TimePicker } from "@mui/x-date-pickers"
import moment, { Moment } from "moment"
import { enqueueSnackbar } from "notistack"
import { useState } from "react"
interface Props {
open: boolean
@ -88,8 +89,60 @@ export const ModalRequestCreate = ({
}: Props) => {
const theme = useTheme()
const isMobile = useMediaQuery(theme.breakpoints.down(650));
const [isSending, setIsSending] = useState(false)
if (isSending) return (
<Modal
open={open}
onClose={onClose}
>
<Box sx={{
position: 'absolute' as 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
bgcolor: 'background.paper',
boxShadow: 24,
width: isMobile ? "343px" : "418px",
borderRadius: "10px",
p: "50px"
}}>
<Typography
sx={{
fontSize: "24px",
fontWeight: 500,
lineHeight: "28.44px",
textAlign: "center"
}}
>Спасибо за заявку!</Typography>
<Typography
sx={{
fontSize: "18px",
lineHeight: "21.33px",
color: "#4D4D4D",
m: "5px 0 30px 0"
}}
>С вами свяжутся в течение 24 часов</Typography>
<Button
variant="contained"
fullWidth
onClick={onClose}
sx={{
py: "12px",
"&:hover": {
backgroundColor: "#581CA7",
},
"&:active": {
color: "white",
backgroundColor: "black",
},
}}
>Ок</Button>
</Box>
</Modal>
)
return (
<Modal
open={open}
@ -159,7 +212,7 @@ export const ModalRequestCreate = ({
console.log(resp)
if (resp[0]?.status === 200) {
enqueueSnackbar("Запрос успешно отправлен")
onClose()
setIsSending(true)
}
if (resp[1]) {
enqueueSnackbar(resp[1])