From 1aeedee8174d227fe93bd571731de076ef3d5e78 Mon Sep 17 00:00:00 2001 From: Eshan Roy Date: Sun, 8 Dec 2024 00:27:58 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20feat(=5Ffollowers):=20add=20gith?= =?UTF-8?q?ub=20follower=20count?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit removed gitlab and dev.to --- src/components/layout/Footer.tsx | 92 +++++++++++++---- src/pages/Home.tsx | 168 ++++++++++++++++++------------- 2 files changed, 170 insertions(+), 90 deletions(-) diff --git a/src/components/layout/Footer.tsx b/src/components/layout/Footer.tsx index 51fa8f8..e3feb64 100644 --- a/src/components/layout/Footer.tsx +++ b/src/components/layout/Footer.tsx @@ -1,7 +1,34 @@ -// import React from 'react'; +import React, { useEffect, useState } from 'react'; import { Github, Gitlab } from 'lucide-react'; export function Footer() { + const [githubFollowers, setGithubFollowers] = useState(null); + const [gitlabFollowers, setGitlabFollowers] = useState(null); + + // Fetch GitHub follower count + useEffect(() => { + async function fetchGithubFollowers() { + const response = await fetch('https://api.github.com/users/Snigdha-OS'); + const data = await response.json(); + if (data.followers !== undefined) { + setGithubFollowers(data.followers); + } + } + fetchGithubFollowers(); + }, []); + + // Fetch GitLab follower count + useEffect(() => { + async function fetchGitlabFollowers() { + const response = await fetch('https://gitlab.com/api/v4/users/Snigdha-OS'); + const data = await response.json(); + if (data[0]?.followers_count !== undefined) { + setGitlabFollowers(data[0].followers_count); + } + } + fetchGitlabFollowers(); + }, []); + return (