File tree Expand file tree Collapse file tree 3 files changed +36
-2
lines changed
components/common/skeleton/my-gathering-skeleton-list Expand file tree Collapse file tree 3 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -6,13 +6,14 @@ import { useGetHostedGatheringListQuery } from '@/src/_queries/my-gathering/host
66import { formatDateToRequest } from '@/src/utils/format-date' ;
77import GatheringListWithDate from '@/src/app/(crew)/my-gathering/_component/gathering-list-with-date' ;
88import PopOverCalendar from '@/src/components/common/input/pop-over-calendar' ;
9+ import MyGatheringSkeletonList from '@/src/components/common/skeleton/my-gathering-skeleton-list' ;
910import { GatheringCardProps } from '@/src/types/gathering-data' ;
1011
1112export default function MyGatheringHostedPage ( ) {
1213 const [ selectedDate , setSelectedDate ] = useState ( new Date ( ) ) ;
1314 const [ hostedGatheringList , setHostedGatheringList ] = useState < GatheringCardProps [ ] > ( ) ;
1415
15- const { data, refetch } = useQuery (
16+ const { data, isLoading , refetch } = useQuery (
1617 useGetHostedGatheringListQuery ( formatDateToRequest ( selectedDate ) ) ,
1718 ) ;
1819
@@ -29,6 +30,7 @@ export default function MyGatheringHostedPage() {
2930 < div className = "py-4 md:py-6" >
3031 < PopOverCalendar value = { selectedDate } onChange = { ( d ) => setSelectedDate ( d ) } />
3132 </ div >
33+ { isLoading && < MyGatheringSkeletonList num = { 6 } /> }
3234 { hostedGatheringList && < GatheringListWithDate gatheringList = { hostedGatheringList } /> }
3335 </ div >
3436 ) ;
Original file line number Diff line number Diff line change @@ -6,13 +6,14 @@ import { useGetJoinedGatheringListQuery } from '@/src/_queries/my-gathering/join
66import { formatDateToRequest } from '@/src/utils/format-date' ;
77import GatheringListWithDate from '@/src/app/(crew)/my-gathering/_component/gathering-list-with-date' ;
88import PopOverCalendar from '@/src/components/common/input/pop-over-calendar' ;
9+ import MyGatheringSkeletonList from '@/src/components/common/skeleton/my-gathering-skeleton-list' ;
910import { GatheringCardProps } from '@/src/types/gathering-data' ;
1011
1112export default function MyGatheringJoinedPage ( ) {
1213 const [ selectedDate , setSelectedDate ] = useState ( new Date ( ) ) ;
1314 const [ joinedGatheringList , setJoinedGatheringList ] = useState < GatheringCardProps [ ] > ( ) ;
1415
15- const { data, refetch } = useQuery (
16+ const { data, isLoading , refetch } = useQuery (
1617 useGetJoinedGatheringListQuery ( formatDateToRequest ( selectedDate ) ) ,
1718 ) ;
1819
@@ -29,6 +30,7 @@ export default function MyGatheringJoinedPage() {
2930 < div className = "py-4 md:py-6" >
3031 < PopOverCalendar value = { selectedDate } onChange = { ( d ) => setSelectedDate ( d ) } />
3132 </ div >
33+ { isLoading && < MyGatheringSkeletonList num = { 6 } /> }
3234 { joinedGatheringList && < GatheringListWithDate gatheringList = { joinedGatheringList } /> }
3335 </ div >
3436 ) ;
Original file line number Diff line number Diff line change 1+ import { Skeleton } from '@mantine/core' ;
2+ import MyGatheringSkeleton from '../my-gathering-skeleton' ;
3+
4+ interface MyGatheringSkeletonListProps {
5+ num : number ;
6+ }
7+
8+ export default function MyGatheringSkeletonList ( { num } : MyGatheringSkeletonListProps ) {
9+ return (
10+ < div >
11+ { [ ...Array ( num ) ] . map ( ( _ , index ) => (
12+ // eslint-disable-next-line react/no-array-index-key
13+ < div key = { index } className = "md:flex" >
14+ < div className = "w-1/6" >
15+ < div className = "flex flex-col gap-2" >
16+ < Skeleton className = "h-4 w-36" />
17+ < Skeleton className = "h-4 w-20" />
18+ </ div >
19+ </ div >
20+ < div className = "relative -mb-3.5 w-0.5 bg-gray-200" >
21+ < div className = "md:corner-dot" />
22+ </ div >
23+ < div className = "flex-1 pb-6 md:pl-8" >
24+ < MyGatheringSkeleton />
25+ </ div >
26+ </ div >
27+ ) ) }
28+ </ div >
29+ ) ;
30+ }
You can’t perform that action at this time.
0 commit comments