Skip to content

Commit e8fe1f7

Browse files
committed
Feat: 게시글 단일 페이지 loading중일 때 스켈레톤 페이지 표시 #65
1 parent be94aab commit e8fe1f7

File tree

4 files changed

+56
-2
lines changed

4 files changed

+56
-2
lines changed

components/ui/BoardCard/BoardIdCard.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import useGetBoard from '@/hooks/queries/useGetBoard';
22
import useGetCommentList from '@/hooks/queries/useGetCommentList';
33
import { BoardCardId } from './BoardCardPackage/BoardCardIdPackage';
4+
import BoardIdLoading from '../Loading/BoardIdLoading';
45

56
export default function BoardIdCard({ boardId }: { boardId: number }) {
6-
const { data: board } = useGetBoard(boardId);
7+
const { data: board, isLoading } = useGetBoard(boardId);
78
const { data: commentList, Observer } = useGetCommentList(boardId);
89

10+
if (isLoading) return <BoardIdLoading />;
911
if (board) {
1012
return (
1113
<BoardCardId>

components/ui/BoardCard/ModalBoardCard.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { BoardCardModal } from '@/components/ui/BoardCard/BoardCardPackage/BoardCardModalPackage';
22
import useGetBoard from '@/hooks/queries/useGetBoard';
33
import useGetCommentList from '@/hooks/queries/useGetCommentList';
4+
import ModalBoardLoading from '../Loading/ModalBoardLoading';
45

56
export default function ModalBoardCard({ boardId }: { boardId: number }) {
6-
const { data: board } = useGetBoard(boardId);
7+
const { data: board, isLoading } = useGetBoard(boardId);
78
const { data: commentList, Observer } = useGetCommentList(boardId);
89

10+
if (isLoading) return <ModalBoardLoading />;
911
if (board) {
1012
return (
1113
<BoardCardModal imgs={board.fileNames}>
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { Divider, FlexBox, Skeleton } from '../ui';
2+
3+
export default function BoardIdLoading() {
4+
return (
5+
<FlexBox
6+
direction="column"
7+
justify="between"
8+
className="w-full h-full gap-4 p-9"
9+
>
10+
<FlexBox justify="start" className="w-full gap-[10px]">
11+
<Skeleton className="rounded-full w-14 h-14" />
12+
<Skeleton className="h-10 rounded-lg w-60" />
13+
</FlexBox>
14+
<Divider type="horizontal" />
15+
<div className="flex flex-row w-full h-full gap-9">
16+
<Skeleton className="w-2/3 h-full rounded-lg" />
17+
<div className="flex flex-col w-1/3 gap-3">
18+
<Skeleton className="w-full rounded-lg h-1/3" />
19+
<Divider type="horizontal" />
20+
<Skeleton className="w-full rounded-lg h-2/3" />
21+
</div>
22+
</div>
23+
</FlexBox>
24+
);
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { Divider, FlexBox, Skeleton } from '../ui';
2+
3+
export default function ModalBoardLoading() {
4+
return (
5+
<FlexBox
6+
direction="column"
7+
justify="between"
8+
className="h-[500px] p-9 rounded-[10px] border-[1px] border-grey-200 gap-4"
9+
>
10+
<FlexBox justify="start" className="w-full gap-[10px]">
11+
<Skeleton className="rounded-full w-14 h-14" />
12+
<Skeleton className="h-10 rounded-lg w-60" />
13+
</FlexBox>
14+
<Divider type="horizontal" />
15+
<div className="flex flex-row w-full h-full gap-9">
16+
<Skeleton className="w-2/3 h-full rounded-lg" />
17+
<div className="flex flex-col w-1/3 gap-3">
18+
<Skeleton className="w-full rounded-lg h-1/3" />
19+
<Divider type="horizontal" />
20+
<Skeleton className="w-full rounded-lg h-2/3" />
21+
</div>
22+
</div>
23+
</FlexBox>
24+
);
25+
}

0 commit comments

Comments
 (0)