Skip to content

Commit f1f6fd3

Browse files
committed
contact form mailing created
1 parent c1264f9 commit f1f6fd3

File tree

4 files changed

+37
-10
lines changed

4 files changed

+37
-10
lines changed

public/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
work correctly both with client-side routing and a non-root public URL.
2525
Learn how to configure a non-root public URL by running `npm run build`.
2626
-->
27-
<title>Stoman</title>
27+
<title>Swapnil Khare</title>
2828
</head>
2929
<body>
3030
<noscript>You need to enable JavaScript to run this app.</noscript>

src/components/contact/ContactDetails.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ import { FiPhone, FiMapPin, FiMail } from 'react-icons/fi';
33
const contacts = [
44
{
55
id: 1,
6-
name: 'Your Address, Your City, Your Country',
6+
name: 'Bhopal, Madhya Pradesh, India',
77
icon: <FiMapPin />,
88
},
99
{
1010
id: 2,
11-
name: 'email@domain.com',
11+
name: 'swapnil.khare25@gmail.com',
1212
icon: <FiMail />,
1313
},
1414
{
1515
id: 3,
16-
name: '555 8888 888',
16+
name: '+91 79970 83838',
1717
icon: <FiPhone />,
1818
},
1919
];

src/components/contact/ContactForm.jsx

+30-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,45 @@
11
import Button from '../reusable/Button';
22
import FormInput from '../reusable/FormInput';
3+
import { useState } from 'react';
34

45
const ContactForm = () => {
6+
const [result, setResult] = useState("");
7+
8+
const handleFormSubmit = async (event) => {
9+
event.preventDefault();
10+
setResult("Sending....");
11+
const formData = new FormData(event.target);
12+
13+
formData.append("access_key", "1e38f9db-eca6-4656-9799-d53c8fdbdf1b");
14+
15+
const response = await fetch("https://api.web3forms.com/submit", {
16+
method: "POST",
17+
body: formData
18+
});
19+
20+
const data = await response.json();
21+
22+
if (data.success) {
23+
setResult("Form Submitted Successfully");
24+
alert("Form Submitted Successfully");
25+
event.target.reset();
26+
} else {
27+
console.log("Error", data);
28+
setResult(data.message);
29+
}
30+
};
31+
532
return (
633
<div className="w-full lg:w-1/2">
734
<div className="leading-loose">
835
<form
9-
onSubmit={(e) => {
10-
e.preventDefault();
11-
}}
36+
onSubmit={handleFormSubmit}
1237
className="max-w-xl m-4 p-6 sm:p-10 bg-secondary-light dark:bg-secondary-dark rounded-xl shadow-xl text-left"
1338
>
1439
<p className="font-general-medium text-primary-dark dark:text-primary-light text-2xl mb-8">
1540
Contact Form
1641
</p>
42+
<input type="hidden" name="access_key" value="1e38f9db-eca6-4656-9799-d53c8fdbdf1b"></input>
1743
<FormInput
1844
inputLabel="Full Name"
1945
labelFor="name"
@@ -67,6 +93,7 @@ const ContactForm = () => {
6793
/>
6894
</div>
6995
</form>
96+
<span>{result}</span>
7097
</div>
7198
</div>
7299
);

src/components/shared/AppFooterCopyright.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ function AppFooterCopyright() {
44
<div className="text-lg text-ternary-dark dark:text-ternary-light">
55
&copy; {new Date().getFullYear()}
66
<a
7-
href="https://github.com/realstoman/react-tailwindcss-portfolio"
7+
href="/"
88
target="__blank"
99
className="hover:underline hover:text-indigo-600 dark:hover:text-indigo-300 ml-1 duration-500"
1010
>
11-
React & Tailwind CSS Portfolio
11+
Web Portfolio
1212
</a>
1313
.
1414
<a
1515
href="https://stoman.me"
1616
target="__blank"
1717
className="text-secondary-dark dark:text-secondary-light font-medium uppercase hover:underline hover:text-indigo-600 dark:hover:text-indigo-300 ml-1 duration-500"
1818
>
19-
Stoman
19+
Swapnil Khare
2020
</a>
2121
</div>
2222
</div>

0 commit comments

Comments
 (0)