File tree Expand file tree Collapse file tree 1 file changed +46
-7
lines changed Expand file tree Collapse file tree 1 file changed +46
-7
lines changed Original file line number Diff line number Diff line change 1+ import React , { useState , useEffect } from "react" ;
12import "../styles/pages/Activities.css"
23import { activities } from "../data/content" ;
34import { ActivityCard } from "../components/activities/ActivityCard" ;
45
56export const Activities = ( ) => {
7+ const [ isLoading , setIsLoading ] = useState ( true ) ;
8+
9+ useEffect ( ( ) => {
10+ // Simulate loading for smooth transition
11+ const timer = setTimeout ( ( ) => {
12+ setIsLoading ( false ) ;
13+ } , 300 ) ;
14+
15+ return ( ) => clearTimeout ( timer ) ;
16+ } , [ ] ) ;
17+
618 return (
719 < div className = "activities-root" >
820 < h1 className = "activities-title" > Activities</ h1 >
921 < div className = "activities-content" >
10- {
11- activities . map ( activity => {
12- return (
13- < ActivityCard activity = { activity } />
14- )
15- } )
16- }
22+ { isLoading ? (
23+ // Loading skeleton
24+ Array . from ( { length : 6 } ) . map ( ( _ , index ) => (
25+ < div key = { index } className = "activity-card-root loading" >
26+ < div style = { {
27+ width : '80px' ,
28+ height : '80px' ,
29+ backgroundColor : '#e2e8f0' ,
30+ borderRadius : '12px' ,
31+ marginBottom : '20px'
32+ } } > </ div >
33+ < div style = { {
34+ width : '80%' ,
35+ height : '20px' ,
36+ backgroundColor : '#e2e8f0' ,
37+ borderRadius : '4px' ,
38+ marginBottom : '12px'
39+ } } > </ div >
40+ < div style = { {
41+ width : '100%' ,
42+ height : '40px' ,
43+ backgroundColor : '#e2e8f0' ,
44+ borderRadius : '4px'
45+ } } > </ div >
46+ </ div >
47+ ) )
48+ ) : (
49+ activities . map ( ( activity , index ) => (
50+ < ActivityCard
51+ key = { activity . urlTerm || index }
52+ activity = { activity }
53+ />
54+ ) )
55+ ) }
1756 </ div >
1857 </ div >
1958 )
You can’t perform that action at this time.
0 commit comments