11import { useState , useEffect } from "react"
22import styles from "./Community.module.css"
33
4- /**
5- * @return {JSX.Element } The rendered Community component.
6- */
74const Community = ( ) => {
5+ const [ communities , setCommunities ] = useState ( [ ] )
6+
7+ useEffect ( ( ) => {
8+ fetchData ( )
9+ } , [ ] )
10+
11+ async function fetchData ( ) {
12+ try {
13+ const response = await fetch ( "/data/communities.json" )
14+ const data = await response . json ( )
15+ setCommunities ( data )
16+ } catch ( error ) {
17+ console . error ( "Error fetching community data:" , error )
18+ }
19+ }
20+
821 return (
922 < div id = "community" className = { styles . community } >
1023 < h1 className = { styles . community__title } >
@@ -16,41 +29,22 @@ const Community = () => {
1629 Partners!
1730 </ h1 >
1831 < div className = { styles . powered } >
19- < a href = "https://pydelhi.org" target = "_blank" rel = "no noreferrer" >
20- < img
21- className = { `${ styles . community__chapter } ${ styles . outline } ` }
22- src = "assets/images/communities/pydelhi.png"
23- alt = "Pydelhi"
24- />
25- </ a >
26- < a href = "https://rustdelhi.in" target = "_blank" rel = "no noreferrer" >
27- < img
28- className = { styles . community__chapter }
29- src = "assets/images/communities/rustdelhi.png"
30- alt = "RustDelhi"
31- />
32- </ a >
33- < a href = "https://linuxdelhi.org/" target = "_blank" rel = "no noreferrer" >
34- < img
35- className = { `${ styles . community__chapter } ${ styles . outline } ` }
36- src = "assets/images/communities/ilugd.png"
37- alt = "India Linux User Group"
38- />
39- </ a >
40- < a href = "https://fossunited.org/" target = "_blank" rel = "no noreferrer" >
41- < img
42- className = { styles . community__chapter }
43- src = "assets/images/communities/foss-united.png"
44- alt = "Foss United Foundation"
45- />
46- </ a >
47- < a href = "https://2024.ubucon.asia/" target = "_blank" rel = "no noreferrer" >
48- < img
49- className = { styles . community__chapter }
50- src = "/assets/images/communities/ubucon.png"
51- alt = "Ubucon Asia"
52- />
53- </ a >
32+ { communities . map ( ( community ) => (
33+ < a
34+ key = { community . name }
35+ href = { community . link }
36+ target = "_blank"
37+ rel = "noopener noreferrer"
38+ >
39+ < img
40+ className = { `${ styles . community__chapter } ${
41+ community . outline ? styles . outline : ""
42+ } `}
43+ src = { community . logo }
44+ alt = { community . name }
45+ />
46+ </ a >
47+ ) ) }
5448 </ div >
5549 </ div >
5650 )
0 commit comments