Skip to content

Commit faa13e0

Browse files
committed
feat: skeleton 컴포넌트 추가
1 parent 389a25d commit faa13e0

File tree

5 files changed

+79
-3
lines changed

5 files changed

+79
-3
lines changed

src/app/match/[id]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default function Match({ params }: { params: { id: string } }) {
5858
<section>
5959
<AsyncBoundary
6060
errorFallback={props => <MatchBanner.ErrorFallback {...props} />}
61-
loadingFallback={<div>배너 로딩중...</div>}
61+
loadingFallback={<MatchBanner.Skeleton />}
6262
>
6363
<MatchByIdFetcher matchId={params.id}>
6464
{data => <MatchBanner {...data} />}

src/app/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function Home() {
2323
<section className="flex flex-col items-center">
2424
<AsyncBoundary
2525
errorFallback={() => <div>에러</div>}
26-
loadingFallback={<div>로딩 중</div>}
26+
loadingFallback={<SportsList.Skeleton />}
2727
>
2828
<SportsListFetcher leagueId={params.get(QUERY_PARAMS.league) || '1'}>
2929
{data => (
@@ -71,7 +71,7 @@ export default function Home() {
7171

7272
<AsyncBoundary
7373
errorFallback={props => <MatchList.ErrorFallback {...props} />}
74-
loadingFallback={<div>로딩 중</div>}
74+
loadingFallback={<MatchList.Skeleton />}
7575
>
7676
<MatchListFetcher {...paramsObj}>
7777
{({ matchList, ...props }) => (

src/components/league/SportsList/index.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,14 @@ export default function SportsList({
3636
</ul>
3737
);
3838
}
39+
40+
SportsList.Skeleton = function Skeleton() {
41+
return (
42+
<ul className="mb-5 flex h-[40px] w-full max-w-md items-center justify-start gap-5 overflow-hidden">
43+
<li className="text-gary-5 h-[40px] w-[70px] animate-pulse cursor-pointer rounded-xl bg-gray-2"></li>
44+
<li className="text-gary-5 h-[40px] w-[70px] animate-pulse cursor-pointer rounded-xl bg-gray-2"></li>
45+
<li className="text-gary-5 h-[40px] w-[70px] animate-pulse cursor-pointer rounded-xl bg-gray-2"></li>
46+
<li className="text-gary-5 h-[40px] w-[70px] animate-pulse cursor-pointer rounded-xl bg-gray-2"></li>
47+
</ul>
48+
);
49+
};

src/components/match/Banner/index.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,25 @@ MatchBanner.ErrorFallback = function ErrorFallback({
3838
</div>
3939
);
4040
};
41+
42+
MatchBanner.Skeleton = function Skeleton() {
43+
return (
44+
<MatchCard
45+
className="flex flex-col"
46+
gameTeams={[]}
47+
startTime={''}
48+
gameQuarter={''}
49+
gameName={''}
50+
sportsName={''}
51+
>
52+
<div className="flex h-full min-h-[200px] items-center justify-around rounded-xl bg-gray-1 shadow-lg">
53+
<MatchCard.Background
54+
viewBox="-3 120 100 50"
55+
width={150}
56+
height={200}
57+
className="h-[200px]"
58+
/>
59+
</div>
60+
</MatchCard>
61+
);
62+
};

src/components/match/MatchList/index.tsx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,46 @@ MatchList.ErrorFallback = function ErrorFallback({
105105
</div>
106106
);
107107
};
108+
109+
MatchList.Skeleton = function Skeleton() {
110+
return (
111+
<>
112+
<div className="mb-14 h-[200px] w-full">
113+
<div className="mb-2 h-[30px] rounded-xl bg-gray-1 px-1 pb-1" />
114+
<div className="flex h-[180px] items-center justify-around rounded-xl bg-gray-1 shadow-lg"></div>
115+
</div>
116+
<div className="mb-14 h-[200px] w-full">
117+
<div className="mb-2 h-[30px] rounded-xl bg-gray-1 px-1 pb-1" />
118+
<div className="flex h-[180px] items-center justify-around rounded-xl bg-gray-1 shadow-lg"></div>
119+
</div>
120+
<div className="mb-14 h-[200px] w-full">
121+
<div className="mb-2 h-[30px] rounded-xl bg-gray-1 px-1 pb-1" />
122+
<div className="flex h-[180px] items-center justify-around rounded-xl bg-gray-1 shadow-lg"></div>
123+
</div>
124+
<div className="mb-14 h-[200px] w-full">
125+
<div className="mb-2 h-[30px] rounded-xl bg-gray-1 px-1 pb-1" />
126+
<div className="flex h-[180px] items-center justify-around rounded-xl bg-gray-1 shadow-lg"></div>
127+
</div>
128+
<div className="mb-14 h-[200px] w-full">
129+
<div className="mb-2 h-[30px] rounded-xl bg-gray-1 px-1 pb-1" />
130+
<div className="flex h-[180px] items-center justify-around rounded-xl bg-gray-1 shadow-lg"></div>
131+
</div>
132+
<div className="mb-14 h-[200px] w-full">
133+
<div className="mb-2 h-[30px] rounded-xl bg-gray-1 px-1 pb-1" />
134+
<div className="flex h-[180px] items-center justify-around rounded-xl bg-gray-1 shadow-lg"></div>
135+
</div>
136+
<div className="mb-14 h-[200px] w-full">
137+
<div className="mb-2 h-[30px] rounded-xl bg-gray-1 px-1 pb-1" />
138+
<div className="flex h-[180px] items-center justify-around rounded-xl bg-gray-1 shadow-lg"></div>
139+
</div>
140+
<div className="mb-14 h-[200px] w-full">
141+
<div className="mb-2 h-[30px] rounded-xl bg-gray-1 px-1 pb-1" />
142+
<div className="flex h-[180px] items-center justify-around rounded-xl bg-gray-1 shadow-lg"></div>
143+
</div>
144+
<div className="mb-14 h-[200px] w-full">
145+
<div className="mb-2 h-[30px] rounded-xl bg-gray-1 px-1 pb-1" />
146+
<div className="flex h-[180px] items-center justify-around rounded-xl bg-gray-1 shadow-lg"></div>
147+
</div>
148+
</>
149+
);
150+
};

0 commit comments

Comments
 (0)