1
1
import { useState , useEffect } from "react"
2
2
import styles from "./Community.module.css"
3
3
4
- /**
5
- * @return {JSX.Element } The rendered Community component.
6
- */
7
4
const 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
+
8
21
return (
9
22
< div id = "community" className = { styles . community } >
10
23
< h1 className = { styles . community__title } >
@@ -16,41 +29,22 @@ const Community = () => {
16
29
Partners!
17
30
</ h1 >
18
31
< 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
+ ) ) }
54
48
</ div >
55
49
</ div >
56
50
)
0 commit comments