V pre0.3_8
parent
f6a6c5d329
commit
87f49f8276
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,22 @@
|
|||||||
|
const submitForm = async (data) => {
|
||||||
|
const response = await fetch("http://localhost:8080/form.php", {
|
||||||
|
method: "POST",
|
||||||
|
mode: "cors",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify(data)
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error('Error!');
|
||||||
|
}
|
||||||
|
return response.status;
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
return 500;
|
||||||
|
})
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default submitForm;
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
import React, { useEffect } from 'react'
|
||||||
|
import { motion, AnimatePresence } from "framer-motion";
|
||||||
|
import { IoMdClose } from "react-icons/io";
|
||||||
|
import { disableBodyScroll, enableBodyScroll } from "body-scroll-lock";
|
||||||
|
|
||||||
|
const Modal = ({className, children, active, setActive, ...props}) => {
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
active ? disableBodyScroll(document.body) : enableBodyScroll(document.body);
|
||||||
|
}, [active])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AnimatePresence>
|
||||||
|
{active &&
|
||||||
|
<motion.div className='min-h-full overflow-y-auto fixed w-full h-full bg-black p-3 bg-opacity-80 left-0 top-0 flex justify-center items-center z-30' initial={{ opacity: 0 }} exit={{ opacity: 0 }} animate={{ opacity: 1 }} transition={{ duration: 0.3 }} onClick={() => setActive(false)}>
|
||||||
|
<motion.div className={['min-w-[320px] max-w-[500px] max-h-full overflow-y-auto w-full p-8 bg-white flex flex-col rounded-lg relative', className].join(' ')} initial={{ opacity: 0, scale: 0 }} exit={{ opacity: 0, scale: 0 }} animate={{ opacity: 1, scale: 1 }} transition={{ duration: 0.5 }} onClick={e => e.stopPropagation()} {...props}>
|
||||||
|
<IoMdClose className='absolute right-3 top-3 text-2xl cursor-pointer' onClick={() => setActive(false)}/>
|
||||||
|
{children}
|
||||||
|
</motion.div>
|
||||||
|
</motion.div>
|
||||||
|
}
|
||||||
|
</AnimatePresence>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Modal;
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 178 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 365 KiB |
Loading…
Reference in New Issue