|
| 1 | +import React, { useState, useEffect } from "react"; |
| 2 | +import styles from "./styles.module.css"; |
| 3 | +import Card from "./Card"; |
| 4 | +import { FaStar } from "react-icons/fa6"; |
| 5 | +import communityLogo1 from "../../../static/img/community/community-github.webp"; |
| 6 | +import communityLogo2 from "../../../static/img/community/community-slack.webp"; |
| 7 | +import communityLogo3 from "../../../static/img/community/community-youtube.webp"; |
| 8 | + |
| 9 | + |
| 10 | +export default function HomepageCommunity() { |
| 11 | + const [stars, setStars] = useState(880); |
| 12 | + useEffect(() => { |
| 13 | + const fetchStars = async () => { |
| 14 | + try { |
| 15 | + const response = await fetch( |
| 16 | + `https://api.github.com/repos/kubearmor/KubeArmor` |
| 17 | + ); |
| 18 | + const data = await response.json(); |
| 19 | + setStars(data.stargazers_count); |
| 20 | + } catch (error) { |
| 21 | + console.error("Error fetching GitHub stars:", error); |
| 22 | + } |
| 23 | + }; |
| 24 | + |
| 25 | + fetchStars(); |
| 26 | + }, []); |
| 27 | + return ( |
| 28 | + <section className={`community ${styles.community}`}> |
| 29 | + <h2 className={styles.communityTitle}>COMMUNITY</h2> |
| 30 | + <h1 className={styles.communityHeader}>Join Our Awesome Community</h1> |
| 31 | + <div className={styles.communityCards}> |
| 32 | + <Card |
| 33 | + cardLink="https://github.com/kubearmor/KubeArmor" |
| 34 | + cardData={ |
| 35 | + <> |
| 36 | + <FaStar color="var(--color-font-sub)" size={20} /> {stars} |
| 37 | + </> |
| 38 | + } |
| 39 | + cardTitle="GitHub" |
| 40 | + cardIcon={communityLogo1} |
| 41 | + /> |
| 42 | + <Card |
| 43 | + cardLink="https://join.slack.com/t/kubearmor/shared_invite/zt-1ltmqdbc6-rSHw~LM6MesZZasmP2hAcA/" |
| 44 | + cardData="600+ Members" |
| 45 | + cardTitle="Slack Channel" |
| 46 | + cardIcon={communityLogo2} |
| 47 | + /> |
| 48 | + <Card |
| 49 | + cardLink="https://www.youtube.com/watch?v=2OK3e87b5jA&list=PLQjomRVn7MXC4obhiz1wuKLrGGip07HiM" |
| 50 | + cardData="250+ Subscribers" |
| 51 | + cardTitle="YouTube Channel" |
| 52 | + cardIcon={communityLogo3} |
| 53 | + /> |
| 54 | + </div> |
| 55 | + </section> |
| 56 | + ); |
| 57 | +} |
0 commit comments