Skip to content

Commit

Permalink
feat: now-playing-movie-review-list 컴포넌트 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
ag502 committed Nov 3, 2024
1 parent a833971 commit 8711b1e
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 2 deletions.
12 changes: 12 additions & 0 deletions apps/web/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import GenresApi from "@/entities/genres/api/genres-api";
import { reviewsQueryKeys } from "@/entities/reviews";
import ReviewsApi from "@/entities/reviews/api/reviews-api";
import { NowPlayingMovieList } from "@/features/get-now-playing-movie-list";
import { NowPlayingMovieReviewList } from "@/features/get-now-playing-movie-review-list";
import { PopularMovieList } from "@/features/get-popular-movie-list";
import { UpcomingMovieList } from "@/features/get-upcoming-movie-list";
import { popularMovieListTitle } from "@/pages/home";
Expand All @@ -25,6 +26,17 @@ export default function Home({ dehydratedState }: InferGetServerSidePropsType<ty
<link href="/favicon.ico" rel="icon" />
</Head>

<Container>
<Row>
<Col lg={12} md={12} sm={4}>
<Text as="h2" className={popularMovieListTitle} size="xl" weight="bold">
리뷰
</Text>
<NowPlayingMovieReviewList />
</Col>
</Row>
</Container>

<Container>
<Row>
<Col lg={12} md={12} sm={4}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ const swiperBreakPoints: SwiperOptions["breakpoints"] = {
export function NowPlayingMovieList() {
const { data: nowPlayingMovieList, status: nowPlayingMovieListStatus } = useNowPlayingMovieListQuery();

// useQueries(movieListQueries.nowPlayingMovieList());

if (nowPlayingMovieListStatus === "pending") {
return <div>Loading...</div>;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./ui";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./now-playing-movie-review-list/now-playing-movie-review-list";
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Swiper, SwiperSlide } from "swiper/react";
import { SwiperOptions } from "swiper/types";

import { useNowPlayingMovieListReviewsQuery } from "@/entities/reviews";
import { NowPlayingMovieReviewCard } from "@/entities/reviews";
import { screenBreakPoints } from "@/shared/styles";

const swiperBreakPoints: SwiperOptions["breakpoints"] = {
[parseInt(screenBreakPoints.sm)]: { slidesPerView: 2, spaceBetween: 12 },
[parseInt(screenBreakPoints.md)]: { slidesPerView: 3, spaceBetween: 16 },
};

export function NowPlayingMovieReviewList() {
const { data, status } = useNowPlayingMovieListReviewsQuery();

if (status === "pending") {
return <div>Loading...</div>;
}

if (status === "error") {
return <div>Error...</div>;
}

return (
<Swiper breakpoints={swiperBreakPoints} slidesPerView={1} spaceBetween={8}>
{data.Reviews.map((review) => {
return (
<SwiperSlide key={review.reviewId}>
<NowPlayingMovieReviewCard review={review} />
</SwiperSlide>
);
})}
</Swiper>
);
}

0 comments on commit 8711b1e

Please sign in to comment.