1
- import Skeleton , { SkeletonTheme } from 'react-loading-skeleton' ;
2
- import { useTheme } from '@emotion/react' ;
3
1
import styled from '@emotion/styled' ;
4
2
import { useRecoilValue } from 'recoil' ;
5
3
6
4
import { TimelineCreateButtonGroup } from '@/activities/timeline/components/TimelineCreateButtonGroup' ;
5
+ import { TimelineSkeletonLoader } from '@/activities/timeline/components/TimelineSkeletonLoader' ;
7
6
import { timelineActivitiesForGroupState } from '@/activities/timeline/states/timelineActivitiesForGroupState' ;
8
7
import { ActivityTargetableObject } from '@/activities/types/ActivityTargetableEntity' ;
9
8
import AnimatedPlaceholder from '@/ui/layout/animated-placeholder/components/AnimatedPlaceholder' ;
@@ -29,82 +28,19 @@ const StyledMainContainer = styled.div`
29
28
justify-content: center;
30
29
` ;
31
30
32
- const StyledSkeletonContainer = styled . div `
33
- align-items: center;
34
- width: 100%;
35
- padding: ${ ( { theme } ) => theme . spacing ( 8 ) } ;
36
- display: flex;
37
- flex-direction: column;
38
- gap: ${ ( { theme } ) => theme . spacing ( 4 ) } ;
39
- flex-wrap: wrap;
40
- align-content: flex-start;
41
- ` ;
42
-
43
- const StyledSkeletonSubSection = styled . div `
44
- display: flex;
45
- gap: ${ ( { theme } ) => theme . spacing ( 4 ) } ;
46
- ` ;
47
-
48
- const StyledSkeletonColumn = styled . div `
49
- display: flex;
50
- flex-direction: column;
51
- gap: ${ ( { theme } ) => theme . spacing ( 3 ) } ;
52
- justify-content: center;
53
- ` ;
54
-
55
- const StyledSkeletonLoader = ( ) => {
56
- const theme = useTheme ( ) ;
57
- return (
58
- < SkeletonTheme
59
- baseColor = { theme . background . tertiary }
60
- highlightColor = { theme . background . transparent . lighter }
61
- borderRadius = { 80 }
62
- >
63
- < Skeleton width = { 24 } height = { 84 } />
64
- </ SkeletonTheme >
65
- ) ;
66
- } ;
67
-
68
- const StyledTimelineSkeletonLoader = ( ) => {
69
- const theme = useTheme ( ) ;
70
- const skeletonItems = Array . from ( { length : 3 } ) . map ( ( _ , index ) => ( {
71
- id : `skeleton-item-${ index } ` ,
72
- } ) ) ;
73
- return (
74
- < SkeletonTheme
75
- baseColor = { theme . background . tertiary }
76
- highlightColor = { theme . background . transparent . lighter }
77
- borderRadius = { 4 }
78
- >
79
- < StyledSkeletonContainer >
80
- < Skeleton width = { 440 } height = { 16 } />
81
- { skeletonItems . map ( ( { id } ) => (
82
- < StyledSkeletonSubSection key = { id } >
83
- < StyledSkeletonLoader />
84
- < StyledSkeletonColumn >
85
- < Skeleton width = { 400 } height = { 24 } />
86
- < Skeleton width = { 400 } height = { 24 } />
87
- </ StyledSkeletonColumn >
88
- </ StyledSkeletonSubSection >
89
- ) ) }
90
- </ StyledSkeletonContainer >
91
- </ SkeletonTheme >
92
- ) ;
93
- } ;
94
-
95
31
export const Timeline = ( {
96
32
targetableObject,
97
33
loading,
98
34
} : {
99
35
targetableObject : ActivityTargetableObject ;
100
- loading ? : boolean ;
36
+ loading : boolean ;
101
37
} ) => {
102
38
const timelineActivitiesForGroup = useRecoilValue (
103
39
timelineActivitiesForGroupState ,
104
40
) ;
105
41
106
- if ( loading === true ) {
107
- return < StyledTimelineSkeletonLoader /> ;
42
+ if ( loading ) {
43
+ return < TimelineSkeletonLoader /> ;
108
44
}
109
45
110
46
if ( timelineActivitiesForGroup . length === 0 ) {
0 commit comments