Frequently Asked Questions
© 2023 Counsellor
@@ -38,9 +52,27 @@ function Footer() { >diff --git a/src/components/Contributors/Contribute.css b/src/components/Contributors/Contribute.css new file mode 100644 index 00000000..1bcfdd50 --- /dev/null +++ b/src/components/Contributors/Contribute.css @@ -0,0 +1,69 @@ +/* Contribute.css */ + +.contributor-heading { + font-size: 3rem !important; +} + +.contributor-cards { + display: flex; + flex-wrap: wrap; + justify-content: flex-start; + gap: 20px; + margin-left: 10%; +} + + +.contributor-member { + width: 180px; + padding: 10px; + border: 1px solid #ccc; + border-radius: 5px; + text-align: center; + background-color: #cce5ff; /* Light bluish background color */ +} + +.contributor-member:hover{ + transform: translateY(-5px); + box-shadow: black 14px; + cursor: pointer; +} + +.contributor-member img { + width: 100px; + height: 100px; + border-radius: 50%; + margin-bottom: 10px; +} + +.contributor-member h3 { + font-size: 16px; +} + +.contributor-member p { + font-size: 14px; +} + +.pagination { + display: flex; + justify-content: center; + margin-top: 20px; +} + +.pagination-button { + margin: 0 5px; + padding: 8px 12px; + border: 1px solid #ccc; + border-radius: 5px; + background-color: #fff; + cursor: pointer; +} + +.pagination-button.active { + background-color: #007bff; + color: #fff; + border-color: #007bff; +} + +.pagination-button:hover { + background-color: #e9ecef; +} diff --git a/src/components/Contributors/Contribute.jsx b/src/components/Contributors/Contribute.jsx new file mode 100644 index 00000000..496f2226 --- /dev/null +++ b/src/components/Contributors/Contribute.jsx @@ -0,0 +1,74 @@ +import React, { useEffect, useState } from 'react'; +import './Contribute.css'; // Import CSS file for styles + +const Contribute = () => { + const owner = 'Counselllor'; + const repo = 'Counsellor-Web'; + const contributorsPerPage = 5; // Changed to display 5 contributors per page + const [contributors, setContributors] = useState([]); + const [currentPage, setCurrentPage] = useState(1); + + useEffect(() => { + const fetchContributors = async () => { + try { + const response = await fetch(`https://api.github.com/repos/${owner}/${repo}/contributors`); + if (!response.ok) { + console.error('Failed to fetch contributors:', response.statusText); + return; + } + const data = await response.json(); + setContributors(data); + } catch (error) { + console.error('Error fetching contributors:', error); + } + }; + + fetchContributors(); + }, [owner, repo]); + + const handleProfileClick = (username) => { + const profileUrl = `https://github.com/${username}`; + window.open(profileUrl, '_blank'); // Open the GitHub profile in a new tab + }; + + const displayContributors = () => { + const startIndex = (currentPage - 1) * contributorsPerPage; + const endIndex = startIndex + contributorsPerPage; + return contributors.slice(startIndex, endIndex).map(contributor => ( +
{contributor.contributions} contributions
+© 2023 Counsellor
@@ -38,9 +52,27 @@ function Footer() { >