Skip to content

Commit

Permalink
feat: 메인 페이지에 skeleton UI 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
0jenn0 committed Aug 5, 2024
1 parent dc3f5a3 commit 1445119
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion frontend/src/components/pages/main/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import TravelogueCard from "@components/pages/main/TravelogueCard/TravelogueCard
import useIntersectionObserver from "@hooks/useIntersectionObserver";

import * as S from "./MainPage.styled";
import TravelogueCardSkeleton from "./TravelogueCard/skeleton/TravelogueCardSkeleton";

const MainPage = () => {
const SKELETON_COUNT = 5;
const { travelogues, status, fetchNextPage } = useInfiniteTravelogues();
const { lastElementRef } = useIntersectionObserver(fetchNextPage);

Expand All @@ -20,7 +22,13 @@ const MainPage = () => {
<h1>지금 뜨고 있는 여행기</h1>
<p>다른 이들의 여행을 한 번 구경해보세요.</p>
</S.MainPageHeaderContainer>
{status === "pending" && <>로딩 ...</>}
{status === "pending" && (
<S.MainPageTraveloguesList>
{Array.from({ length: SKELETON_COUNT }, () => (
<TravelogueCardSkeleton />
))}
</S.MainPageTraveloguesList>
)}
<S.MainPageTraveloguesList>
{travelogues.map(({ userAvatar, id, title, thumbnail, likes }) => (
<TravelogueCard
Expand Down

0 comments on commit 1445119

Please sign in to comment.