Skip to content

Commit b6bb027

Browse files
authored
Merge pull request #481 from devs-in-tech/Contributor
fix: contributor page
2 parents 647d981 + b7b8fe1 commit b6bb027

File tree

1 file changed

+58
-42
lines changed

1 file changed

+58
-42
lines changed

src/pages/Contributors.js

Lines changed: 58 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
import Footer from "@/components/Footer";
2+
import Header from "@/components/header";
23
import Navbar from "@/components/Navbar";
34
import axios from "axios";
45
import Image from "next/image";
56
import { useEffect, useState } from "react";
67
import { BsGithub } from "react-icons/bs";
8+
import HashLoader from "react-spinners/HashLoader";
79

810
const Contributors = () => {
911
const [contributors, setContributors] = useState([]);
12+
const [loading, setLoading] = useState(false);
1013

1114
useEffect(() => {
1215
const fetchData = async () => {
1316
try {
17+
setLoading(true);
1418
const response = await axios.get(
1519
"https://api.github.com/repos/devs-in-tech/DevsInTech/contributors"
1620
);
1721
const data = response.data;
1822
setContributors(data);
23+
setLoading(false);
1924
} catch (error) {
2025
console.error(error);
2126
}
@@ -27,52 +32,63 @@ const Contributors = () => {
2732
return (
2833
<>
2934
<Navbar />
30-
<h1 className="text-5xl font-bold text-white text-center">
31-
Our Contributors
32-
</h1>
33-
<div className="contributor-container relative z-[1] flex justify-center items-center flex-wrap p-[1em]">
34-
{contributors.map((i) => (
35-
<div
36-
className="contributor-card relative w-[300px] h-[400px] shadow-[0_15px_35px_rgba(0,0,0,0.9)] flex justify-center items-center flex-col backdrop-blur-2xl bg-clip-padding m-[1em] rounded-[15px] bg-gray-900 cursor-auto"
37-
key={i.login}
38-
>
39-
<div className="contributor-content relative flex justify-center items-center flex-col opacity-50 transition duration-[0.5s]">
40-
<div className="relative w-[150px] h-[150px] overflow-hidden rounded-[50%] border-[10px] border-solid border-[rgba(0,0,0,0.25)]">
41-
<Image
42-
className="absolute w-full h-full object-cover left-0 top-0"
43-
src={i.avatar_url}
44-
alt={i.login}
45-
width={400}
46-
height={400}
47-
/>
48-
</div>
35+
<Header name="Our Contributors" />
36+
{loading ? (
37+
<div className="w-full h-96 flex justify-center items-center">
38+
<HashLoader
39+
loading={loading}
40+
aria-label="Loading Spinner"
41+
data-testid="loader"
42+
color={"#8d06d6"}
43+
size={68}
44+
/>
45+
</div>
46+
) : (
47+
<div className="contributor-container relative z-[1] flex justify-center items-center flex-wrap p-[1em]">
48+
{contributors.map((i) => (
49+
<div
50+
className="contributor-card relative w-[300px] h-[400px] shadow-[0_15px_35px_rgba(0,0,0,0.9)] flex justify-center items-center flex-col backdrop-blur-2xl bg-clip-padding m-[1em] rounded-[15px] bg-gray-900 cursor-auto"
51+
key={i.login}
52+
>
53+
<div className="contributor-content relative flex justify-center items-center flex-col opacity-50 transition duration-[0.5s]">
54+
<div className="relative w-[150px] h-[150px] overflow-hidden rounded-[50%] border-[10px] border-solid border-[rgba(0,0,0,0.25)]">
55+
<Image
56+
className="absolute w-full h-full object-cover left-0 top-0"
57+
src={i.avatar_url}
58+
alt={i.login}
59+
width={400}
60+
height={400}
61+
/>
62+
</div>
4963

50-
<div className="contributor-details">
51-
<h3 className="text-white uppercase tracking-[2px] font-medium text-lg text-center leading-[1.1em] mt-5 mb-2.5 mx-0">
52-
{i.login}
53-
<br />
54-
<span className="text-xs font-light">
55-
Commits: {i.contributions}
56-
</span>
57-
</h3>
64+
<div className="contributor-details">
65+
<h3 className="text-white uppercase tracking-[2px] font-medium text-lg text-center leading-[1.1em] mt-5 mb-2.5 mx-0">
66+
{i.login}
67+
<br />
68+
<span className="text-xs font-light">
69+
Commits: {i.contributions}
70+
</span>
71+
</h3>
72+
</div>
5873
</div>
74+
75+
<ul className="contributor-social-icons absolute flex justify-center items-center bottom-[50px]">
76+
<li className="translate-y-10 opacity-0 transition duration-[0.5s] mx-2.5 my-0">
77+
<a
78+
href={i.html_url}
79+
target="_blank"
80+
rel="noopener noreferrer"
81+
className="text-2xl text-white"
82+
>
83+
<BsGithub />
84+
</a>
85+
</li>
86+
</ul>
5987
</div>
88+
))}
89+
</div>
90+
)}
6091

61-
<ul className="contributor-social-icons absolute flex justify-center items-center bottom-[50px]">
62-
<li className="translate-y-10 opacity-0 transition duration-[0.5s] mx-2.5 my-0">
63-
<a
64-
href={i.html_url}
65-
target="_blank"
66-
rel="noopener noreferrer"
67-
className="text-2xl text-white"
68-
>
69-
<BsGithub />
70-
</a>
71-
</li>
72-
</ul>
73-
</div>
74-
))}
75-
</div>
7692
<Footer />
7793
</>
7894
);

0 commit comments

Comments
 (0)