Skip to content

Commit 37cc679

Browse files
authored
Merge pull request #180 from Ojas13-git/feature/feedback-card
Feature/feedback card
2 parents 4d9421e + 8f1d31a commit 37cc679

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import React, { useState } from 'react';
2+
import { IoDocumentTextOutline } from "react-icons/io5";
3+
4+
const FeedbackCard = () => {
5+
const [formData, setFormData] = useState({ message: '', email: '' });
6+
7+
const handleChange = (e: { target: { id: any; value: any; }; }) => {
8+
const { id, value } = e.target;
9+
setFormData({ ...formData, [id]: value });
10+
};
11+
12+
const handleSubmit = (e: { preventDefault: () => void; }) => {
13+
e.preventDefault();
14+
15+
const { message, email } = formData;
16+
17+
// Create a well-structured feedback message body
18+
const mailtoLink = `mailto:[email protected]?subject=Feedback&body=${encodeURIComponent(`
19+
Hello JiffyScan Team,
20+
21+
I hope you're doing well. I wanted to provide some feedback on your platform:
22+
23+
"${message}"
24+
25+
Thank you for taking the time to consider my input. Please feel free to reach out if you need more details.
26+
27+
Best regards,
28+
${email}
29+
`)}`;
30+
31+
// Open user's email client with pre-filled subject, body, and email address
32+
window.location.href = mailtoLink;
33+
};
34+
35+
return (
36+
<div className="m-16 mx-auto md:max-w-2xl lg:max-w-[749px] p-4">
37+
<div className="rounded-xl border-2 lg:flex lg:items-center">
38+
<div className="sm:w-full sm:max-w-md py-8 px-6 lg:mt-0 lg:flex-1 lg:justify-center lg:items-center space-y-2">
39+
<p className="flex gap-2 font-inter font-medium items-center text-md sm:text-xl text-black">
40+
<IoDocumentTextOutline />
41+
Faced an Issue? Help us improve.
42+
</p>
43+
<form onSubmit={handleSubmit} className="space-y-4 sm:space-y-0 sm:flex sm:space-x-3">
44+
<div className="w-full">
45+
<label htmlFor="message" className="sr-only">Message</label>
46+
<input
47+
id="message"
48+
type="text"
49+
value={formData.message}
50+
onChange={handleChange}
51+
className="w-full md:w-[300px] lg:w-[341px] rounded-md border-1 px-5 py-3 text-black placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-gray-700"
52+
placeholder="Write Message"
53+
required
54+
/>
55+
</div>
56+
<div className="w-full">
57+
<label htmlFor="email" className="sr-only">Email address</label>
58+
<input
59+
id="email"
60+
type="email"
61+
value={formData.email}
62+
onChange={handleChange}
63+
className="w-full md:w-[200px] lg:w-[220px] rounded-md border-1 px-5 py-3 text-black placeholder-gray-500 focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-gray-700"
64+
placeholder="Your email"
65+
required
66+
/>
67+
</div>
68+
<button
69+
type="submit"
70+
className="mt-3 flex w-full lg:w-[108px] items-center justify-center rounded-md bg-[#2c85df] px-5 py-3 text-base font-medium text-white hover:bg-gray-400 focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-gray-700 sm:mt-0 sm:w-auto"
71+
>
72+
Send
73+
</button>
74+
</form>
75+
</div>
76+
</div>
77+
</div>
78+
);
79+
}
80+
81+
export default FeedbackCard;

src/components/global/footer/Footer.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ import Copyright from './Copyright';
77
import Donations from './Donations';
88
import pages from './pages.json';
99
import socials from './social.json';
10+
import FeedbackCard from './FeedbackCard';
11+
1012

1113
function Footer() {
1214
return (
15+
<>
16+
<FeedbackCard/>
1317
<footer className="bg-dark-600 py-8 md:py-12 text-white">
1418
<div className="container flex flex-col gap-8 md:gap-12">
1519
<div className=" flex md:flex-row flex-col md:justify-between md:items-center">
@@ -66,6 +70,7 @@ function Footer() {
6670
</div>
6771
</div>
6872
</footer>
73+
</>
6974
);
7075
}
7176

0 commit comments

Comments
 (0)