-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #297 from TBorundia/master
Added Contributor's Page
- Loading branch information
Showing
5 changed files
with
275 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
import './App.css'; | ||
import PreNavbar from './components/PreNavbar'; | ||
import {BrowserRouter as Router } from "react-router-dom"; | ||
import AllRoutes from './components/AllRoutes.jsx'; | ||
import ScrollToTop from './components/Scrolltotop.jsx'; | ||
import "./App.css"; | ||
import PreNavbar from "./components/PreNavbar"; | ||
import { BrowserRouter as Router } from "react-router-dom"; | ||
import AllRoutes from "./components/AllRoutes.jsx"; | ||
import ScrollToTop from "./components/Scrolltotop.jsx"; | ||
function App() { | ||
return ( | ||
|
||
<Router> | ||
<PreNavbar/> | ||
<PreNavbar /> | ||
<ScrollToTop /> | ||
<AllRoutes/> | ||
<AllRoutes /> | ||
</Router> | ||
); | ||
} | ||
|
||
export default App; | ||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
.contributors-container { | ||
width: 100%; | ||
height: 100%; | ||
padding-top: 2rem; | ||
overflow: hidden; | ||
} | ||
|
||
.github-icon { | ||
margin-right: 0.5rem; | ||
vertical-align: middle; | ||
fill: white; /* Adjust color as needed */ | ||
} | ||
|
||
.contributors-title { | ||
margin-top: 0rem; | ||
text-align: center; | ||
color: #170374; | ||
font-size: 2.5rem; | ||
font-weight: bold; | ||
margin-bottom: 2rem; | ||
text-transform: uppercase; | ||
box-shadow: #015a92; | ||
} | ||
|
||
.contributors-grid { | ||
display: flex; | ||
flex-wrap: wrap; | ||
justify-content: center; | ||
gap: 2.5rem; | ||
margin-bottom: 4rem; | ||
} | ||
|
||
.contributor-card { | ||
position: relative; | ||
width: 100%; | ||
max-width: 20%; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
background-color: rgb(189, 187, 188); | ||
border: 2px solid #0993fd; | ||
border-radius: 0.5rem; | ||
box-shadow: rgba(0, 0, 0, 0.4); | ||
padding: 1rem; | ||
overflow: hidden; | ||
transition: transform 0.4s ease, box-shadow 0.3s ease; | ||
} | ||
|
||
.contributor-card:hover { | ||
transform: scale(1.05); | ||
box-shadow: 0 4px 6px rgba(1, 3, 3, 0.7); | ||
} | ||
|
||
.contributor-card:hover p { | ||
color: black; | ||
text-shadow: 1px 1px 2px rgb(11, 1, 60), 0 0 0.2em rgb(0, 191, 255), | ||
0 0 0.8em rgb(135, 206, 235); | ||
color: rgb(0, 0, 0); | ||
font-weight: 500; | ||
} | ||
|
||
.contributor-card:hover h2 { | ||
text-shadow: 1px 1px 2px rgba(33, 1, 160, 0.926), 0 0 0.2em rgb(162, 35, 6), | ||
0 0 0.8em rgb(4, 20, 163); | ||
color: white; | ||
font-size: 1.04rem; | ||
font-weight: 600; | ||
text-decoration: wavy; | ||
} | ||
|
||
.contributor-card:hover .contributor-avatar { | ||
border: 3.5px solid #080101; | ||
width: 5.2rem; | ||
box-shadow: -2px 4px 10px 1px rgba(6, 1, 1, 0.75); | ||
height: 5.2rem; | ||
} | ||
|
||
.contributor-card::before { | ||
content: ""; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
background-color: white; | ||
transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out; | ||
transform: translate(-100%, -100%); | ||
opacity: 0; | ||
z-index: -1; | ||
} | ||
|
||
.contributor-card:hover::before { | ||
box-shadow: rgba(6, 1, 1, 0.9); | ||
} | ||
|
||
.contributor-link { | ||
display: block; | ||
color: black; | ||
} | ||
|
||
.contributor-avatar { | ||
width: 5rem; | ||
height: 5rem; | ||
border-radius: 50%; | ||
object-fit: cover; | ||
margin-bottom: 1rem; | ||
border: 2px solid #070704; | ||
transition: border 0.4s ease-in-out, height 0.4s ease-in-out, | ||
width 0.4s ease-in-out, box-shadow 0.3s ease-in-out; | ||
} | ||
|
||
.contributor-name { | ||
font-size: 1rem; | ||
font-weight: 600; | ||
color: #060606; | ||
margin-bottom: 0.5rem; | ||
transition: text-shadow 0.4s ease-in-out, font-size 0.5s ease-in-out, | ||
text-decoration 0.4s ease-in-out; | ||
} | ||
|
||
.contributor-contributions { | ||
color: rgb(1, 6, 131); | ||
transition: text-shadow 0.4s ease-in-out; | ||
} | ||
|
||
/* Media Queries for Responsiveness */ | ||
@media (max-width: 1200px) { | ||
.contributor-card { | ||
max-width: 33.333%; | ||
} | ||
} | ||
|
||
@media (max-width: 992px) { | ||
.contributor-card { | ||
max-width: 50%; | ||
} | ||
} | ||
|
||
@media (max-width: 768px) { | ||
.contributor-card { | ||
max-width: 97%; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
import React, { useEffect, useState } from "react"; | ||
import axios from "axios"; | ||
import "./Contributors.css"; | ||
|
||
function Contributors() { | ||
const [contributors, setContributors] = useState([]); | ||
const [loading, setLoading] = useState(true); | ||
const [error, setError] = useState(null); | ||
|
||
useEffect(() => { | ||
async function fetchContributors() { | ||
let allContributors = []; | ||
let page = 1; | ||
|
||
try { | ||
while (true) { | ||
const response = await axios.get( | ||
`https://api.github.com/repos/soham0005/ElectroKart/contributors`, | ||
{ | ||
params: { | ||
per_page: 100, | ||
page, | ||
}, | ||
} | ||
); | ||
const data = response.data; | ||
|
||
// Check GitHub rate limit | ||
const remaining = response.headers["x-ratelimit-remaining"]; | ||
if (remaining === "0") { | ||
setError("Rate limit exceeded. Please try again later."); | ||
break; | ||
} | ||
|
||
if (data.length === 0) { | ||
break; | ||
} | ||
|
||
allContributors = [...allContributors, ...data]; | ||
page++; | ||
} | ||
|
||
// Sort contributors by number of contributions | ||
allContributors.sort((a, b) => b.contributions - a.contributions); | ||
setContributors(allContributors); | ||
} catch (error) { | ||
console.error("Error fetching contributors:", error.message); | ||
setError("Failed to load contributors. Please try again later."); | ||
} finally { | ||
setLoading(false); | ||
} | ||
} | ||
fetchContributors(); | ||
}, []); | ||
|
||
if (loading) { | ||
return <div className="loading-message">Loading contributors...</div>; | ||
} | ||
|
||
if (error) { | ||
return ( | ||
<div className="error-message"> | ||
<p>{error}</p> | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div className="contributors-container"> | ||
<h1 className="contributors-title">Our Contributors</h1> | ||
<div className="contributors-grid"> | ||
{contributors.length > 0 ? ( | ||
contributors.map((contributor) => ( | ||
<div key={contributor.id} className="contributor-card"> | ||
<a | ||
href={contributor.html_url} | ||
className="contributor-link" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
<img | ||
src={contributor.avatar_url} | ||
alt={contributor.login} | ||
onError={(e) => { | ||
e.target.src = "path/to/fallback_image.png"; | ||
}} | ||
className="contributor-avatar" | ||
/> | ||
</a> | ||
<h2 className="contributor-name">{contributor.login}</h2> | ||
<p className="contributor-contributions"> | ||
Contributions: {contributor.contributions} | ||
</p> | ||
</div> | ||
)) | ||
) : ( | ||
<p>No contributors found.</p> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default Contributors; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters