diff --git a/src/mainPage/features/comment/commentCarousel/CommentCarousel.jsx b/src/mainPage/features/comment/commentCarousel/CommentCarousel.jsx index 8cd7eda1..e607e98c 100644 --- a/src/mainPage/features/comment/commentCarousel/CommentCarousel.jsx +++ b/src/mainPage/features/comment/commentCarousel/CommentCarousel.jsx @@ -1,5 +1,6 @@ import { useQuery } from "@common/dataFetch/getQuery.js"; import { fetchServer } from "@common/dataFetch/fetchServer.js"; +import CommentCarouselNoData from "./CommentCarouselNoData.jsx"; import AutoScrollCarousel from "../autoScrollCarousel"; import { formatDate } from "@common/utils.js"; import { EVENT_ID } from "@common/constants.js"; @@ -14,6 +15,8 @@ function mask(string) { function CommentCarousel() { const { comments } = useQuery("comment-data", () => fetchServer(`/api/v1/comment/${EVENT_ID}`)); + if(comments.length === 0) return ; + return (
diff --git a/src/mainPage/features/comment/commentCarousel/CommentCarouselNoData.jsx b/src/mainPage/features/comment/commentCarousel/CommentCarouselNoData.jsx new file mode 100644 index 00000000..2ed1dae0 --- /dev/null +++ b/src/mainPage/features/comment/commentCarousel/CommentCarouselNoData.jsx @@ -0,0 +1,12 @@ +function CommentCarouselNoData() { + return ( +
+
+ 기대평 없음 +

기대평이 없어요!

+
+
+ ); +} + +export default CommentCarouselNoData; diff --git a/src/mainPage/features/comment/mock.js b/src/mainPage/features/comment/mock.js index 72d9c60b..c48122b8 100644 --- a/src/mainPage/features/comment/mock.js +++ b/src/mainPage/features/comment/mock.js @@ -2,7 +2,7 @@ import { http, HttpResponse } from "msw"; import { makeLorem } from "@common/mock/utils.js"; function getCommentMock() { - return Array.from({ length: 2 }, (_, i) => { + return Array.from({ length: 20 }, (_, i) => { return { id: i * 100 + Math.floor(Math.random() * 99), content: makeLorem(5, 12),