Skip to content

Commit 15d23b0

Browse files
add donation section to main page (#9)
* add donation section to main page * Refactor: dynamic image rendering for volunteer images * update project structure
1 parent 0df4623 commit 15d23b0

File tree

7 files changed

+103
-0
lines changed

7 files changed

+103
-0
lines changed
27.6 KB
Loading
21.7 KB
Loading
144 KB
Loading

src/components/Donation.tsx

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import React from 'react';
2+
import { donationData } from '../constants/Donation';
3+
import { Link } from 'react-router-dom';
4+
import { volunteerImages } from '../constants/Volunteer';
5+
6+
const Donation: React.FC = () => {
7+
const handleClick = () => {
8+
window.location.href = donationData.url;
9+
};
10+
11+
return (
12+
<section className="relative overflow-hidden bg-white text-black py-16 px-4">
13+
<div className="absolute top-1/8 right-1/6 w-96 h-96 bg-[#8df090] rounded-full -mt-32 -mr-32 z-1" />
14+
<div className="absolute top-1/2 right-1/6 w-96 h-96 bg-[#ebee67] rounded-full -mt-32 -mr-64 z-0" />
15+
16+
<div className="relative z-10">
17+
<div className="container mx-auto text-left">
18+
<p className="font-Caveat text-2xl uppercase">
19+
{donationData.subHeading}
20+
</p>
21+
<h1 className="text-4xl font-bold mt-2">{donationData.heading}</h1>
22+
<p className="text-lg mt-4">{donationData.paragraph}</p>
23+
<button
24+
onClick={handleClick}
25+
className="mt-6 px-6 py-3 bg-[#fbd04d] text-black text-2xl font-bold rounded-full shadow-lg hover:bg-yellow-500 transition duration-300 outline-4 uppercase"
26+
>
27+
{donationData.buttonText}
28+
</button>
29+
</div>
30+
31+
<Link to="/volunteer">
32+
<div className="mt-12 flex justify-center items-center">
33+
<div className="relative">
34+
<div className="absolute -top-8 -right-8">
35+
<i className="fas fa-arrow-right text-2xl" />
36+
</div>
37+
<div className="bg-white border border-gray-300 rounded-full px-4 py-2 flex items-center shadow-lg">
38+
{volunteerImages.map((volunteer) => (
39+
<img
40+
key={volunteer.id}
41+
alt={volunteer.alt}
42+
className="w-8 h-8 rounded-full border-2 border-white -ml-2"
43+
src={volunteer.src}
44+
/>
45+
))}
46+
<span className="ml-4 text-sm">Join the volunteer</span>
47+
<span className="ml-2 bg-blue-500 text-white text-xs rounded-full px-2 py-1">
48+
+1000
49+
</span>
50+
</div>
51+
</div>
52+
</div>
53+
</Link>
54+
55+
<div className="mt-16 text-center">
56+
<p className="text-lg">
57+
Join Us to Empower Young Learners all Across the Globe. The simplest
58+
way to get involved is to join our newsletter.
59+
</p>
60+
<div className="mt-4 flex justify-center items-center">
61+
<input
62+
className="px-4 py-2 border border-gray-300 rounded-l-full focus:outline-none"
63+
placeholder="Enter your email"
64+
type="email"
65+
/>
66+
<button className="px-6 py-2 bg-red-500 text-white font-bold rounded-r-full shadow-lg hover:bg-red-600 transition duration-300">
67+
SUBSCRIBE
68+
</button>
69+
</div>
70+
</div>
71+
</div>
72+
</section>
73+
);
74+
};
75+
76+
export default Donation;

src/constants/Donation.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
interface donationData {
2+
heading: string;
3+
subHeading: string;
4+
paragraph: string;
5+
url: string;
6+
buttonText: string;
7+
}
8+
9+
export const donationData: donationData = {
10+
heading: 'Support and Empower Those in Need',
11+
paragraph:
12+
"Support Sugar Labs and make a difference in children's education. Sugar Labs has brought educational software and authentic problem-solving to millions in the US and across the globe.",
13+
subHeading: 'Donate to Sugar Labs to make a positive impact',
14+
url: 'https://www.paypal.com/donate?campaign_id=NEAV3YL4H6B5S',
15+
buttonText: 'Donate now',
16+
};

src/constants/Volunteer.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import volunteer1 from '/assets/Volunteer/volunteer-1.png';
2+
import volunteer2 from '/assets/Volunteer/volunteer-2.png';
3+
import volunteer3 from '/assets/Volunteer/volunteer-3.png';
4+
5+
export const volunteerImages = [
6+
{ id: 1, alt: 'Volunteer 1', src: volunteer1 },
7+
{ id: 2, alt: 'Volunteer 2', src: volunteer2 },
8+
{ id: 3, alt: 'Volunteer 3', src: volunteer3 },
9+
];

src/pages/MainPage.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Footer from '../sections/Footer';
33
import Stats from '../components/Stats.tsx';
44
import Try from '../components/Try.tsx';
55
import Info from '../components/Info.tsx';
6+
import Donation from '../components/Donation.tsx';
67

78
const MainPage = () => {
89
return (
@@ -11,6 +12,7 @@ const MainPage = () => {
1112
<Info />
1213
<Stats />
1314
<Try />
15+
<Donation />
1416
<Footer />
1517
</>
1618
);

0 commit comments

Comments
 (0)