-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontact.tsx
74 lines (67 loc) · 2.03 KB
/
contact.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
"use client";
import React from "react";
import SectionHeading from "./section-heading";
import { motion } from "framer-motion";
import { useSectionInView } from "@/lib/hooks";
import { sendEmail } from "@/actions/sendEmail";
import SubmitBtn from "./submit-btn";
import toast from "react-hot-toast";
export default function Contact() {
const { ref } = useSectionInView("Contact");
return (
<motion.section
id="contact"
ref={ref}
className="mb-20 sm:mb-28 w-[min(100%,38rem)] text-center"
initial={{
opacity: 0,
}}
whileInView={{
opacity: 1,
}}
transition={{
duration: 1,
}}
viewport={{
once: true,
}}
>
<SectionHeading>Contact me</SectionHeading>
<p className="text-gray-700 -mt-6 dark:text-white/80">
Please contact me directly at{" "}
<a className="underline" href="mailto:archanjothecreation@gmail.com">
archanjothecreation@gmail.com
</a>{" "}
<br></br>or through this form.
</p>
<form
className="mt-10 flex flex-col dark:text-black"
action={async (formData) => {
const { data, error } = await sendEmail(formData);
if (error) {
toast.error(error);
return;
}
toast.success("Email sent successfully!");
}}
>
<input
className="h-14 px-4 rounded-lg borderBlack dark:bg-white dark:bg-opacity-10 dark:focus:bg-opacity-15 dark:text-white transition-all dark:outline-none"
name="senderEmail"
type="email"
required
maxLength={500}
placeholder="Your email"
/>
<textarea
className="h-52 my-3 rounded-lg borderBlack p-4 dark:bg-white dark:bg-opacity-10 dark:focus:bg-opacity-15 dark:text-white transition-all dark:outline-none"
name="message"
placeholder="Your message"
required
maxLength={5000}
/>
<SubmitBtn />
</form>
</motion.section>
);
}