-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathContact.jsx
More file actions
190 lines (183 loc) · 6.71 KB
/
Contact.jsx
File metadata and controls
190 lines (183 loc) · 6.71 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
import React from "react";
import { Container, Row, Col } from "reactstrap";
import Link from "next/link";
import SectionSubtitle from "./SectionSubtitle";
import classes from "../../styles/contact.module.css";
import Form from "./Form";
import axios from "axios";
import { useState } from "react";
import NewTwitterLogo from "./NewTwitterlogo";
import { RiYoutubeFill, RiGithubFill, RiTwitterFill, RiLinkedinFill } from "react-icons/ri";
const Contact = () => {
const [submitted, setSubmitted] = useState(false);
const handleSubmit = async (event) => {
event.preventDefault();
const data = {
name: event.target.name.value,
email: event.target.email.value,
message: event.target.message.value,
};
console.log(data);
try {
const response = await axios.post("/api/contact", data);
if (response.status === 200) {
setSubmitted(true);
console.log("Form submitted");
} else {
console.log("Failed");
}
} catch (error) {
console.log(error);
}
};
return (
<section id="contact" className={`${classes.contact}`}>
<Container>
<Row className="flex justify-between flex-col md:flex-row ">
<Col lg="4" md="6">
<h3 className="mt-4 mb-4 text-2xl">Connect with me</h3>
<ul className={`${classes.contact__info__list}`}>
<li className={`${classes.info__item}`}>
<span>
<i className="ri-map-pin-line"></i>
</span>
<p>Planet Earth 🌍</p>
</li>
<li className={`${classes.info__item}`}>
<span>
<a href="mailto:piyushgarg.dev@gmail.com">
<i className="ri-mail-line"></i>
</a>
</span>
<p>
<a className="hover:text-[#01d293]" href="mailto:piyushgarg.dev@gmail.com">
piyushgarg.dev@gmail.com
</a>
</p>
</li>
</ul>
<div className={`${classes.social__links}`}>
<Link
className="hover:text-[#FF0000] duration-300"
aria-label="Youtube Channel"
href="https://youtube.com/@piyushgargdev"
target="_blank"
>
{/* size={40} color="red" */}
<RiYoutubeFill />
</Link>
<Link
className="hover:text-gray-600 duration-300"
aria-label="Github Profile"
href="https://github.com/piyushgarg-dev"
target="_blank"
>
<RiGithubFill />
</Link>
<Link
className="hover:text-blue-400 duration-300"
aria-label="Twitter Account"
href="https://twitter.com/piyushgarg_dev"
target="_blank"
>
<NewTwitterLogo />
</Link>
<Link
className="hover:text-blue-600 duration-300"
aria-label="LinedIn Account"
href="https://www.linkedin.com/in/piyushgarg195/"
target="_blank"
>
<RiLinkedinFill />
</Link>
</div>
</Col>
<Col lg="5" md="6">
{submitted ? (
<div className="flex justify-center items-center text-xl font-bold h-[30vh]">
<p>Message Sent!</p>
</div>
) : (
<>
<div className="mt-4 mb-4 text-2xl"><SectionSubtitle subtitle="Contact me" /></div>
<form className="flex flex-col space-y-4" onSubmit={handleSubmit}>
<input
className="text-md border-transparent rounded-lg block w-full p-2.5 bg-[#171f38] placeholder-gray-400 text-white"
type="text"
name="name"
placeholder="Your Full Name"
required
autoComplete="off"
/>
<input
className="text-md border-transparent rounded-lg block w-full p-2.5 bg-[#171f38] placeholder-gray-400 text-white"
type="email"
name="email"
placeholder="Your Email"
required
autoComplete="off"
/>
<textarea
className="text-md border-transparent rounded-lg block w-full p-2.5 bg-[#171f38] placeholder-gray-400 text-white"
name="message"
placeholder="Your Message"
required
rows="4"
autoComplete="off"
></textarea>
<button
type="submit"
className="bg-blue-500 text-white px-4 py-2 rounded-md hover:bg-blue-600"
>
Send Message
</button>
</form>
</>
)}
</Col>
</Row>
</Container>
{/* <Container className=" w-80">
{submitted ? (
<div className="flex justify-center items-center text-xl font-bold h-[30vh]">
<p>Message Sent!</p>
</div>
) : (
<form className="flex flex-col space-y-4" onSubmit={handleSubmit}>
<input
className="border border-gray-300 bg-transparent px-4 py-2 rounded-md focus:outline-none focus:ring-2 focus:rgba(77, 181, 255, 0.4) text-white"
type="text"
name="name"
placeholder="Your Full Name"
required
autoComplete="off"
/>
<input
className="border border-gray-300 bg-transparent px-4 py-2 rounded-md focus:outline-none focus:ring-2 focus:[rgba(77, 181, 255, 0.4)] text-white"
type="email"
name="email"
placeholder="Your Email"
required
autoComplete="off"
/>
<textarea
className="border border-gray-300 bg-transparent px-4 py-2 rounded-md focus:outline-none focus:ring-2 focus:rgba(77, 181, 255, 0.4) text-white"
name="message"
placeholder="Your Message"
required
rows="4"
autoComplete="off"
></textarea>
<button
type="submit"
className="bg-blue-500 text-white px-4 py-2 rounded-md hover:bg-blue-600"
>
Send Message
</button>
</form>
)}
</Container> */}
</section>
);
};
export default Contact;