Skip to content

Commit

Permalink
[modify] 기대평 없을 때 폴백 UI 추가 (resolve #84)
Browse files Browse the repository at this point in the history
  • Loading branch information
lybell-art committed Aug 20, 2024
1 parent 53d27ce commit ef57bfd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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 <CommentCarouselNoData />;

return (
<div className="w-full h-[29rem]">
<AutoScrollCarousel speed={0.1} gap={28}>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function CommentCarouselNoData() {
return (
<div className="w-full h-[29rem] flex justify-center items-center px-6">
<div className="w-full max-w-[1200px] h-96 bg-neutral-50 flex flex-col justify-center items-center gap-4">
<img src="/icons/error.svg" alt="기대평 없음" width="120" height="120" />
<p className="text-body-l text-red-500 font-bold">기대평이 없어요!</p>
</div>
</div>
);
}

export default CommentCarouselNoData;
2 changes: 1 addition & 1 deletion src/mainPage/features/comment/mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit ef57bfd

Please sign in to comment.