forked from anup2702/build-on-coffee
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContribute.jsx
More file actions
360 lines (345 loc) · 15.6 KB
/
Copy pathContribute.jsx
File metadata and controls
360 lines (345 loc) · 15.6 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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
import { useState , useEffect} from "react";
const steps = [
{
step: 1,
title: "Find an Issue or Idea:",
content:
"Check our GitHub Issues for existing tasks. If you have a new idea, feel free to open a new issue to discuss it with the community.",
link: "https://github.com/anup2702/build-on-coffee/issues",
},
{
step: 2,
title: "Fork the Repository:",
content:
"Fork the BuildOnCoffee repository to your own GitHub account. This creates a copy where you can make your changes.",
link: "https://github.com/anup2702/build-on-coffee",
},
{
step: 3,
title: "Clone Your Fork:",
content:
"Clone your forked repository to your local machine using `git clone [your-fork-url]`.",
},
{
step: 4,
title: "Create a New Branch:",
content:
"Always work on a new branch for your contributions: `git checkout -b feature/your-feature-name` or `bugfix/your-bugfix-name`.",
},
{
step: 5,
title: "Make Your Changes:",
content:
"Implement your changes, whether it's code, documentation, design assets, or content. Ensure your code follows our coding standards (if any).",
},
{
step: 6,
title: "Test Your Changes:",
content:
"Before submitting, thoroughly test your changes to ensure they work as expected and don't introduce new bugs.",
},
{
step: 7,
title: "Commit Your Changes:",
content:
'Commit your changes with clear and concise commit messages: `git commit -m "feat: Add new feature X"` or `fix: Resolve bug Y`.',
},
{
step: 8,
title: "Push to Your Fork:",
content:
"Push your changes to your forked repository on GitHub: `git push origin feature/your-feature-name`.",
},
{
step: 9,
title: "Open a Pull Request (PR):",
content:
"Go to the original BuildOnCoffee repository on GitHub and open a new Pull Request. Provide a detailed description of your changes and reference any related issues.",
},
{
step: 10,
title: "Review and Merge:",
content:
"Our team will review your PR. We might ask for changes or clarifications. Once approved, your contribution will be merged!",
},
];
const ContributePage = () => {
const [openIndex, setOpenIndex] = useState(null);
const [contributors, setContributors] = useState([]);
useEffect(() => {
fetch("https://api.github.com/repos/anup2702/build-on-coffee/contributors")
.then((res) => res.json())
.then((data) => {
const sorted = data
.map((c, index) => ({
id: index + 1,
name: c.login,
profileUrl: c.html_url,
contributions: c.contributions,
avatarUrl: c.avatar_url,
}))
.sort((a, b) => b.contributions - a.contributions)
.slice(0, 7);
setContributors(sorted);
})
.catch((err) => console.error("GitHub API Error:", err));
}, []);
const toggleContent = (index) => {
setOpenIndex(openIndex === index ? null : index);
};
return (
<div className="min-h-screen bg-gradient-to-br from-slate-50 via-blue-50 to-indigo-100 py-12 px-4 sm:px-6 lg:px-8">
<div className="max-w-7xl mx-auto bg-white/80 backdrop-blur-sm rounded-2xl shadow-2xl p-8 sm:p-10 lg:p-12 border border-white/20">
{/* Page Title */}
<div className="text-center mb-12 sm:mb-16">
<h1 className="text-5xl font-extrabold bg-gradient-to-r from-gray-900 via-blue-800 to-indigo-900 bg-clip-text text-transparent mb-4">
Contribute to BuildOnCoffee
</h1>
<div className="w-24 h-1 bg-gradient-to-r from-blue-500 to-indigo-600 mx-auto rounded-full"></div>
</div>
{/* Two Column Layout */}
<div className="grid grid-cols-1 md:grid-cols-2 gap-12 mb-16">
{/* How to Contribute */}
<section>
<div className="flex items-center mb-8">
<div className="w-12 h-12 bg-gradient-to-r from-blue-500 to-indigo-600 rounded-xl flex items-center justify-center mr-4 shadow-lg">
<svg
className="w-6 h-6 text-white"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
/>
</svg>
</div>
<h2 className="text-3xl font-bold bg-gradient-to-r from-gray-800 to-gray-900 bg-clip-text text-transparent">
How You Can Contribute
</h2>
</div>
<div className="space-y-6">
{steps.map((item, index) => (
<div
key={index}
className="group relative cursor-pointer"
onClick={() => toggleContent(index)}
>
<div className="flex items-start space-x-4 p-6 bg-white rounded-xl shadow-sm hover:shadow-lg transition-all duration-300 border border-gray-100 hover:border-blue-200">
<div className="w-10 h-10 bg-gradient-to-r from-blue-500 to-indigo-600 rounded-full flex items-center justify-center text-white font-bold text-sm shadow-lg">
{item.step}
</div>
<div className="flex-1">
<h3 className="text-lg font-medium text-gray-900 group-hover:text-blue-700 transition-colors">
{item.title}
</h3>
{openIndex === index && (
<div className="text-sm text-gray-700 mt-2">
{item.link ? (
<>
{item.content
.split(
/(GitHub Issues|BuildOnCoffee repository)/
)
.map((text, idx) =>
text === "GitHub Issues" ? (
<a
key={idx}
href={item.link}
target="_blank"
rel="noopener noreferrer"
className="text-blue-600 hover:text-blue-800 underline font-medium"
>
GitHub Issues
</a>
) : text === "BuildOnCoffee repository" ? (
<a
key={idx}
href={item.link}
target="_blank"
rel="noopener noreferrer"
className="text-blue-600 hover:text-blue-800 underline font-medium"
>
BuildOnCoffee repository
</a>
) : (
<span key={idx}>{text}</span>
)
)}
</>
) : (
item.content
)}
</div>
)}
</div>
</div>
</div>
))}
</div>
</section>
{/* Top Contributors */}
<section>
<div className="flex items-center mb-8">
<div className="w-12 h-12 bg-gradient-to-r from-blue-500 to-indigo-600 rounded-xl flex items-center justify-center mr-4 shadow-lg">
<svg
className="w-6 h-6 text-white"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"
/>
</svg>
</div>
<h2 className="text-3xl font-bold bg-gradient-to-r from-gray-800 to-gray-900 bg-clip-text text-transparent">
Our Top Contributors
</h2>
</div>
<div className="grid gap-4 mt-6">
{contributors.map((contributor) => (
<div
key={contributor.id}
className="flex items-center justify-between p-4 bg-white rounded-xl shadow-sm hover:shadow-md transition border border-gray-100 hover:border-blue-200"
>
<div className="flex items-center space-x-4">
<img
src={contributor.avatarUrl}
alt={contributor.name}
className="w-12 h-12 rounded-full shadow-lg"
/>
<div>
<h3 className="text-lg font-semibold text-gray-900">
{contributor.name}
</h3>
<p className="text-sm text-blue-800 font-medium">
{contributor.contributions} Contributions
</p>
</div>
</div>
<a
href={contributor.profileUrl}
target="_blank"
rel="noopener noreferrer"
className="text-gray-600 hover:text-gray-900"
>
View Profile
</a>
</div>
))}
</div>
<div className="grid grid-cols-1 md:grid-cols-2 gap-12 lg:gap-16 mb-16"></div>
{/* Call to Action */}
<div className="relative overflow-hidden absolute inset-0 bg-gradient-to-r from-blue-600 via-indigo-600 to-purple-600 opacity-10 rounded-2xl"></div>
<div className="relative bg-gradient-to-r from-blue-50 via-indigo-50 to-purple-50 p-10 rounded-2xl shadow-inner border border-blue-200 text-center">
<div className="mb-6">
<div className="w-16 h-16 bg-gradient-to-r from-blue-500 to-indigo-600 rounded-full flex items-center justify-center mx-auto mb-4 shadow-lg">
<svg
className="w-8 h-8 text-white"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M13 10V3L4 14h7v7l9-11h-7z"
/>
</svg>
</div>
<h2 className="text-4xl font-bold bg-gradient-to-r from-blue-800 to-indigo-900 bg-clip-text text-transparent mb-4">
Ready to Make a Difference?
</h2>
</div>
<p className="text-xl text-gray-700 mb-8 max-w-2xl mx-auto">
Once you've completed your work, don't forget to raise a Pull
Request on our GitHub repository!
</p>
<a
href="https://github.com/anup2702/build-on-coffee"
target="_blank"
rel="noopener noreferrer"
className="inline-flex items-center px-10 py-4 bg-gradient-to-r from-gray-900 to-black text-white text-lg font-semibold rounded-xl shadow-lg hover:shadow-xl transform hover:scale-105 transition-all duration-300 border border-gray-800 hover:border-gray-700"
>
Raise a Pull Request
<svg
className="ml-3 -mr-1 h-6 w-6"
fill="currentColor"
viewBox="0 0 24 24"
aria-hidden="true"
>
<path
fillRule="evenodd"
d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.47.087.686-.233.686-.507 0-.25-.011-1.05-.016-1.845-2.759.593-3.346-1.187-3.346-1.187-.452-1.152-1.107-1.459-1.107-1.459-.905-.618.069-.607.069-.607 1.002.07 1.531 1.032 1.531 1.032.892 1.529 2.341 1.087 2.91.832.091-.647.35-1.087.636-1.332-2.22-.253-4.555-1.113-4.555-4.949 0-1.092.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.025A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.025 2.747-1.025.546 1.379.202 2.398.099 2.65.64.7 1.028 1.596 1.028 2.688 0 3.845-2.339 4.681-4.569 4.935.359.308.678.919.678 1.852 0 1.335-.012 2.41-.012 2.727 0 .275.215.596.695.503C21.133 20.203 24 16.447 24 12.017 24 6.484 19.522 2 14 2h-2z"
clipRule="evenodd"
/>
</svg>
</a>
</div>
</section>
</div>
</div>
</div>
);
};
export default ContributePage;
// {
// /* Call to Action */
// }
// <section className="relative overflow-hidden">
// <div className="absolute inset-0 bg-gradient-to-r from-blue-600 via-indigo-600 to-purple-600 opacity-10 rounded-2xl"></div>
// <div className="relative bg-gradient-to-r from-blue-50 via-indigo-50 to-purple-50 p-10 rounded-2xl shadow-inner border border-blue-200 text-center">
// <div className="mb-6">
// <div className="w-16 h-16 bg-gradient-to-r from-blue-500 to-indigo-600 rounded-full flex items-center justify-center mx-auto mb-4 shadow-lg">
// <svg
// className="w-8 h-8 text-white"
// fill="none"
// stroke="currentColor"
// viewBox="0 0 24 24"
// >
// <path
// strokeLinecap="round"
// strokeLinejoin="round"
// strokeWidth={2}
// d="M13 10V3L4 14h7v7l9-11h-7z"
// />
// </svg>
// </div>
// <h2 className="text-4xl font-bold bg-gradient-to-r from-blue-800 to-indigo-900 bg-clip-text text-transparent mb-4">
// Ready to Make a Difference?
// </h2>
// </div>
// <p className="text-xl text-gray-700 mb-8 max-w-2xl mx-auto">
// Once you've completed your work, don't forget to raise a Pull Request on
// our GitHub repository!
// </p>
// <a
// href="https://github.com/anup2702/build-on-coffee"
// target="_blank"
// rel="noopener noreferrer"
// className="inline-flex items-center px-10 py-4 bg-gradient-to-r from-gray-900 to-black text-white text-lg font-semibold rounded-xl shadow-lg hover:shadow-xl transform hover:scale-105 transition-all duration-300 border border-gray-800 hover:border-gray-700"
// >
// Raise a Pull Request
// <svg
// className="ml-3 -mr-1 h-6 w-6"
// fill="currentColor"
// viewBox="0 0 24 24"
// aria-hidden="true"
// >
// <path
// fillRule="evenodd"
// d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.47.087.686-.233.686-.507 0-.25-.011-1.05-.016-1.845-2.759.593-3.346-1.187-3.346-1.187-.452-1.152-1.107-1.459-1.107-1.459-.905-.618.069-.607.069-.607 1.002.07 1.531 1.032 1.531 1.032.892 1.529 2.341 1.087 2.91.832.091-.647.35-1.087.636-1.332-2.22-.253-4.555-1.113-4.555-4.949 0-1.092.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.025A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.025 2.747-1.025.546 1.379.202 2.398.099 2.65.64.7 1.028 1.596 1.028 2.688 0 3.845-2.339 4.681-4.569 4.935.359.308.678.919.678 1.852 0 1.335-.012 2.41-.012 2.727 0 .275.215.596.695.503C21.133 20.203 24 16.447 24 12.017 24 6.484 19.522 2 14 2h-2z"
// clipRule="evenodd"
// />
// </svg>
// </a>
// </div>
// </section>;