Skip to content

Commit ab7f897

Browse files
Contact components is complete
1 parent 4083e60 commit ab7f897

3 files changed

Lines changed: 171 additions & 0 deletions

File tree

src/App.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Title from './components/Title/Title'
66
import About from './components/About/About'
77
import Campus from './components/Campus/Campus'
88
import Testimonials from './components/Testimonials/Testimonials'
9+
import Contact from './components/Contact/Contact'
910

1011
const App = () => {
1112
return (
@@ -20,6 +21,8 @@ const App = () => {
2021
<Campus/>
2122
<Title subTitle='TESTIMONIALS' title='What Student Says'/>
2223
<Testimonials/>
24+
<Title subTitle='Contact Us' title='Get in Touch'/>
25+
<Contact/>
2326
</div>
2427
</div>
2528
)

src/components/Contact/Contact.css

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
.contact{
2+
margin: 80px auto ;
3+
max-width: 90%;
4+
display: flex;
5+
align-items: center;
6+
justify-content: space-between;
7+
}
8+
.contact-col{
9+
flex-basis: 48%;
10+
color: #676767;
11+
}
12+
.contact-col h3{
13+
color: #000F38;
14+
font-weight: 500;
15+
font-size: 25px;
16+
display: flex;
17+
align-items: center;
18+
margin-bottom: 20px;
19+
}
20+
.contact-col h3 img{
21+
width: 35px;
22+
margin-left: 10px;
23+
}
24+
.contact-col p{
25+
max-width: 450px;
26+
list-style: 0.3;
27+
}
28+
.contact-col ul li{
29+
display: flex;
30+
align-items: center;
31+
margin: 20px 0;
32+
}
33+
.contact-col ul li img{
34+
width: 25px;
35+
margin-right: 10px;
36+
37+
}
38+
39+
.contact form input, .contact form textarea{
40+
display: block;
41+
width: 100%;
42+
background: #d7d7e7;
43+
padding: 15px;
44+
border: 0;
45+
outline: 0;
46+
margin-bottom: 15px;
47+
margin-top: 5px;
48+
resize: none;
49+
}
50+
.contact-col span{
51+
display: block;
52+
margin: 20px 0;
53+
}

src/components/Contact/Contact.jsx

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
import React, { useState } from "react";
2+
import "./Contact.css";
3+
import msg_icon from "../../assets/msg-icon.png";
4+
import mail_icon from "../../assets/mail-icon.png";
5+
import phone_icon from "../../assets/phone-icon.png";
6+
import location_icon from "../../assets/location-icon.png";
7+
import white_arrow from "../../assets/white-arrow.png";
8+
9+
const Contact = () => {
10+
const [result, setResult] = useState("");
11+
const [sending, setSending] = useState(false);
12+
13+
const onSubmit = async (event) => {
14+
event.preventDefault();
15+
setSending(true);
16+
setResult("");
17+
18+
try {
19+
const formData = new FormData(event.target);
20+
formData.append("access_key", "f6aa4535-abbe-4360-98a4-641edc5c3a26");
21+
22+
const response = await fetch("https://api.web3forms.com/submit", {
23+
method: "POST",
24+
body: formData,
25+
});
26+
27+
const data = await response.json();
28+
if (data.success) {
29+
setResult("Success! Your message has been sent.");
30+
event.target.reset();
31+
} else {
32+
setResult("Error: Unable to send message. Please try again later.");
33+
}
34+
} catch (err) {
35+
setResult("Error: Network or server problem.");
36+
console.error(err);
37+
} finally {
38+
setSending(false);
39+
}
40+
};
41+
42+
return (
43+
<div className="contact">
44+
<div className="contact-col">
45+
<h3>
46+
Send us a message <img src={msg_icon} alt="message icon" />
47+
</h3>
48+
<p>
49+
Feel free to reach out through the contact form or find our contact
50+
information below. Your feedback, questions, and suggestions are
51+
important to us as we strive to provide exceptional service to our
52+
university community.
53+
</p>
54+
<ul>
55+
<li>
56+
<img src={mail_icon} alt="mail icon" /> contact@sakibdeveloper.com
57+
</li>
58+
<li>
59+
<img src={phone_icon} alt="phone icon" /> 0123456789
60+
</li>
61+
<li>
62+
<img src={location_icon} alt="location icon" /> Dhaka, Tajgaon,
63+
Bangladesh
64+
</li>
65+
</ul>
66+
</div>
67+
68+
<div className="contact-col">
69+
<form onSubmit={onSubmit}>
70+
<label htmlFor="name">Your name</label>
71+
<input
72+
id="name"
73+
type="text"
74+
name="name"
75+
placeholder="Enter your name"
76+
required
77+
/>
78+
79+
<label htmlFor="phone">Phone Number</label>
80+
<input
81+
id="phone"
82+
type="tel"
83+
name="phone"
84+
placeholder="Enter your phone number"
85+
required
86+
/>
87+
88+
<label htmlFor="message">Write your message here</label>
89+
<textarea
90+
id="message"
91+
name="message"
92+
rows="6"
93+
placeholder="Enter your message"
94+
required
95+
/>
96+
97+
<button type="submit" className="dark-btn" disabled={sending}>
98+
{sending ? "Sending..." : "Submit now"}{" "}
99+
<img src={white_arrow} alt="arrow" />
100+
</button>
101+
</form>
102+
103+
<div
104+
role="status"
105+
aria-live="polite"
106+
style={{ marginTop: "12px", minHeight: "1.2em" }}
107+
>
108+
{result && <span>{result}</span>}
109+
</div>
110+
</div>
111+
</div>
112+
);
113+
};
114+
115+
export default Contact;

0 commit comments

Comments
 (0)