From 0d4a07a621b9dd7b6b4dbab2356181901f96316b Mon Sep 17 00:00:00 2001 From: mahenoorsalat Date: Wed, 30 Oct 2024 16:23:08 +0530 Subject: [PATCH] Contributor list added --- src/pages/home/index.jsx | 82 ++++++++++++++++++++++++++++------------ 1 file changed, 58 insertions(+), 24 deletions(-) diff --git a/src/pages/home/index.jsx b/src/pages/home/index.jsx index 6dacfb1..a3cb6f9 100644 --- a/src/pages/home/index.jsx +++ b/src/pages/home/index.jsx @@ -5,7 +5,24 @@ import GithubIcon from '@/assets/icons/github.svg'; export function HomePage() { const [text, setText] = useState(''); const fullText = 'Beriuk Berajah dan Berkembang'; - const typingDelay = 100; // Typing speed in milliseconds + const typingDelay = 100; + + const [contributors, setContributors] = useState([]); + + const fetchContributor = async () => { + try { + const response = await fetch(`https://api.github.com/repos/lotengdev/lotengdev-web/contributors?per_page=1000`); + const data = await response.json(); + console.log(data); + setContributors(data); + } catch (error) { + console.log(error); + } + }; + + useEffect(() => { + fetchContributor(); + }, []); useEffect(() => { let index = 0; @@ -18,34 +35,51 @@ export function HomePage() { } }, typingDelay); - return () => clearInterval(intervalId); // Cleanup on unmount + return () => clearInterval(intervalId); }, []); return ( -
-
- -
-
- - {text} - -
-
- Komunitas programmer di Lombok Tengah yang membahas - hal seputar IT, - Programming, dan masih banyak lagi. -
-
- - Join Group - - - Contribute - + <> +
+
+ +
+
+ + {text} + +
+
+ + Komunitas programmer di Lombok Tengah yang membahas hal seputar IT, Programming, dan masih banyak lagi. + +
+
-
+
+

Contributors

+
+ {contributors && contributors.map((contributor) => ( + + ))} +
+
+ ); }