-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7011007
commit 68b8870
Showing
20 changed files
with
350 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,7 @@ dist-ssr | |
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
|
||
.env | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,163 @@ | ||
import React from 'react' | ||
import React, { useRef, useState } from "react"; | ||
import { motion } from "framer-motion"; | ||
import emailjs from "@emailjs/browser"; | ||
import { ToastContainer, toast } from "react-toastify"; | ||
import "react-toastify/dist/ReactToastify.css"; | ||
|
||
import { styles } from "../styles"; | ||
import { EarthCanvas } from "./canvas"; | ||
import { SectionWrapper } from "../hoc"; | ||
import { slideIn } from "../utils/motion"; | ||
|
||
const Contact = () => { | ||
const formRef = useRef(); | ||
const [form, setForm] = useState({ | ||
name: "", | ||
email: "", | ||
message: "", | ||
}); | ||
|
||
const [loading, setLoading] = useState(false); | ||
|
||
const handleChange = (e) => { | ||
const { target } = e; | ||
const { name, value } = target; | ||
|
||
setForm({ | ||
...form, | ||
[name]: value, | ||
}); | ||
}; | ||
|
||
const handleSubmit = (e) => { | ||
e.preventDefault(); | ||
setLoading(true); | ||
|
||
emailjs | ||
.send( | ||
import.meta.env.VITE_APP_EMAILJS_SERVICE_ID, | ||
import.meta.env.VITE_APP_EMAILJS_TEMPLATE_ID, | ||
{ | ||
from_name: form.name, | ||
to_name: "Adrien Poua", | ||
from_email: form.email, | ||
to_email: "[email protected]", | ||
message: form.message, | ||
}, | ||
import.meta.env.VITE_APP_EMAILJS_PUBLIC_KEY | ||
) | ||
.then( | ||
() => { | ||
setLoading(false); | ||
toast.success('Message bien envoyé', { | ||
position: "bottom-center", | ||
autoClose: 5000, | ||
hideProgressBar: false, | ||
closeOnClick: true, | ||
pauseOnHover: true, | ||
draggable: true, | ||
progress: undefined, | ||
theme: "light", | ||
}); | ||
setForm({ | ||
name: "", | ||
email: "", | ||
message: "", | ||
}); | ||
}, | ||
(error) => { | ||
setLoading(false); | ||
console.error(error); | ||
toast.error("Erreur lors de l'envoi du message", { | ||
position: "top-center", | ||
autoClose: 5000, | ||
hideProgressBar: false, | ||
closeOnClick: true, | ||
}); | ||
} | ||
); | ||
}; | ||
|
||
return ( | ||
<div>Contact</div> | ||
) | ||
} | ||
<div | ||
className={`xl:mt-12 flex xl:flex-row flex-col-reverse gap-10 overflow-hidden`} | ||
> | ||
<motion.div | ||
variants={slideIn("left", "tween", 0.2, 1)} | ||
className='flex-[0.75] bg-black-100 p-8 rounded-2xl' | ||
> | ||
<p className={styles.sectionSubText}>Get in touch</p> | ||
<h3 className={styles.sectionHeadText}>Contact.</h3> | ||
|
||
<form | ||
ref={formRef} | ||
onSubmit={handleSubmit} | ||
className='mt-12 flex flex-col gap-8' | ||
> | ||
<label className='flex flex-col'> | ||
<span className='text-white font-medium mb-4'>Votre prénom </span> | ||
<input | ||
type='text' | ||
name='name' | ||
value={form.name} | ||
onChange={handleChange} | ||
placeholder='Elon' | ||
className='bg-tertiary py-4 px-6 placeholder:text-secondary text-white rounded-lg outline-none border-none font-medium' | ||
/> | ||
</label> | ||
<label className='flex flex-col'> | ||
<span className='text-white font-medium mb-4'>Votre email</span> | ||
<input | ||
type='email' | ||
name='email' | ||
value={form.email} | ||
onChange={handleChange} | ||
placeholder='[email protected]' | ||
className='bg-tertiary py-4 px-6 placeholder:text-secondary text-white rounded-lg outline-none border-none font-medium' | ||
/> | ||
</label> | ||
<label className='flex flex-col'> | ||
<span className='text-white font-medium mb-4'>Votre message</span> | ||
<textarea | ||
rows={7} | ||
name='message' | ||
value={form.message} | ||
onChange={handleChange} | ||
placeholder="Salut, j'ai un projet à te proposer !" | ||
className='bg-tertiary py-4 px-6 placeholder:text-secondary text-white rounded-lg outline-none border-none font-medium' | ||
/> | ||
</label> | ||
|
||
<button | ||
type='submit' | ||
className='bg-tertiary py-3 px-8 rounded-xl outline-none w-fit text-white font-bold shadow-md shadow-primary' | ||
> | ||
{loading ? "Sending..." : "Send"} | ||
</button> | ||
</form> | ||
</motion.div> | ||
|
||
<motion.div | ||
variants={slideIn("right", "tween", 0.2, 1)} | ||
className='xl:flex-1 xl:h-auto md:h-[550px] h-[350px]' | ||
> | ||
<EarthCanvas /> | ||
<ToastContainer | ||
position='bottom-center' | ||
autoClose={5000} | ||
hideProgressBar={false} | ||
newestOnTop={false} | ||
closeOnClick | ||
rtl={false} | ||
pauseOnFocusLoss | ||
draggable | ||
pauseOnHover | ||
theme='light' | ||
/>{" "} | ||
</motion.div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Contact | ||
const WrappedContact = SectionWrapper(Contact, "contact"); | ||
export default WrappedContact; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import React from 'react' | ||
|
||
const Feedbacks = () => { | ||
return ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.