-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from f-lab-edu/feature/28-now-playing-movie-re…
…view [FEATURE] 상영중인 영화 리뷰 목록 UI 추가
- Loading branch information
Showing
17 changed files
with
351 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
apps/web/src/entities/reviews/api/response-types/review-author-details.server.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export interface ReviewAuthorDetails { | ||
name: string; | ||
name: string | null; | ||
username: string; | ||
avatar_path: string; | ||
rating: string; | ||
rating: string | null; | ||
} |
4 changes: 2 additions & 2 deletions
4
apps/web/src/entities/reviews/api/response-types/review-author-details.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export interface ReviewAuthorDetailsDTO { | ||
name: string; | ||
name: string | null; | ||
username: string; | ||
avatarPath: string; | ||
rating: string; | ||
rating: string | null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from "./api"; | ||
export * from "./models"; | ||
export * from "./ui"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./now-playing-movie-review-card/now-playing-movie-review-card"; |
56 changes: 56 additions & 0 deletions
56
...rc/entities/reviews/ui/now-playing-movie-review-card/now-playing-movie-review-card.css.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { createVar, style } from "@vanilla-extract/css"; | ||
import { calc } from "@vanilla-extract/css-utils"; | ||
|
||
import { globalThemeVars, themeColorContract } from "@/shared/styles"; | ||
|
||
const cardHeight = createVar(); | ||
const cardPadding = createVar(); | ||
|
||
export const reviewCardContainer = style({ | ||
vars: { | ||
[cardHeight]: "182px", | ||
[cardPadding]: globalThemeVars.space["3"], | ||
}, | ||
backgroundColor: themeColorContract.color.background, | ||
border: `1px solid ${themeColorContract.color.gray20}`, | ||
borderRadius: globalThemeVars.radius.lg, | ||
height: cardHeight, | ||
padding: cardPadding, | ||
}); | ||
|
||
export const reviewCardTitle = style({ | ||
display: "flex", | ||
justifyContent: "space-between", | ||
}); | ||
|
||
export const reviewCardContent = style({ | ||
display: "flex", | ||
gap: globalThemeVars.space["2"], | ||
padding: `${globalThemeVars.space["3"]} 0`, | ||
height: "100%", | ||
}); | ||
|
||
export const reviewCardPosterWrapper = style({ | ||
flex: "1 0 0", | ||
overflow: "hidden", | ||
borderRadius: globalThemeVars.radius.sm, | ||
height: "fit-content", | ||
}); | ||
|
||
export const reviewCardContentWrapper = style({ | ||
flex: "4 0 0", | ||
}); | ||
|
||
export const reviewMovieTitle = style({ | ||
marginBottom: globalThemeVars.space["1"], | ||
}); | ||
|
||
export const reviewContent = style({ | ||
overflow: "hidden", | ||
textOverflow: "ellipsis", | ||
display: "-webkit-box", | ||
WebkitBoxOrient: "vertical", | ||
WebkitLineClamp: 4, | ||
lineHeight: "1.5em", | ||
maxHeight: calc(cardHeight).divide(2).add(cardPadding).toString(), | ||
}); |
52 changes: 52 additions & 0 deletions
52
...b/src/entities/reviews/ui/now-playing-movie-review-card/now-playing-movie-review-card.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { AspectRatio } from "@repo/ui/aspect-ratio"; | ||
import Image from "next/image"; | ||
|
||
import { NowPlayingMovieReviewModel } from "@/entities/reviews"; | ||
import { Text } from "@/shared/ui/text"; | ||
|
||
import { | ||
reviewCardContainer, | ||
reviewCardTitle, | ||
reviewCardContent, | ||
reviewMovieTitle, | ||
reviewContent, | ||
reviewCardPosterWrapper, | ||
reviewCardContentWrapper, | ||
} from "./now-playing-movie-review-card.css"; | ||
|
||
export function NowPlayingMovieReviewCard({ review }: { review: NowPlayingMovieReviewModel }) { | ||
return ( | ||
<article className={reviewCardContainer}> | ||
<div className={reviewCardTitle}> | ||
<Text color="tertiaryText" size="sm"> | ||
{review.AuthorDetails.UserName} | ||
</Text> | ||
<Text color="tertiaryText" size="sm"> | ||
{review.AuthorDetails.ScoreMaximumFive} | ||
</Text> | ||
</div> | ||
|
||
<div className={reviewCardContent}> | ||
<div className={reviewCardPosterWrapper}> | ||
<AspectRatio ratio={10 / 7}> | ||
<Image | ||
alt={`${review.movieTitle} poster image`} | ||
height={100} | ||
src={`${process.env.NEXT_PUBLIC_TMDB_RESOURCE_BASE_URL}/t/p/w200${review.posterPath}`} | ||
style={{ width: "100%", height: "100%" }} | ||
width={100} | ||
/> | ||
</AspectRatio> | ||
</div> | ||
<div className={reviewCardContentWrapper}> | ||
<Text as="h1" className={reviewMovieTitle} size="md" weight="medium"> | ||
{review.movieTitle} | ||
</Text> | ||
<Text className={reviewContent} color="tertiaryText" lineHeight="5" size="md"> | ||
{review.content} | ||
</Text> | ||
</div> | ||
</div> | ||
</article> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
apps/web/src/features/get-now-playing-movie-review-list/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./ui"; |
1 change: 1 addition & 0 deletions
1
apps/web/src/features/get-now-playing-movie-review-list/ui/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; |
35 changes: 35 additions & 0 deletions
35
...ying-movie-review-list/ui/now-playing-movie-review-list/now-playing-movie-review-list.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,38 @@ | ||
export const radius = { | ||
/** | ||
* @description `0px` | ||
*/ | ||
none: "0", | ||
/** | ||
* @description `0.125rem` // `16 * 0.125 = 2px` | ||
*/ | ||
sm: "0.125rem", | ||
/** | ||
* @description `0.25rem` // `16 * 0.25 = 4px` | ||
*/ | ||
base: "0.25rem", | ||
/** | ||
* @description `0.375rem // 16 * 0.375 = 6px` | ||
*/ | ||
md: "0.375rem", | ||
/** | ||
* @description `0.5rem` // `16 * 0.5 = 8px` | ||
*/ | ||
lg: "0.5rem", | ||
/** | ||
* @description `0.75rem` // `16 * 0.75 = 12px` | ||
*/ | ||
xl: "0.75rem", | ||
/** | ||
* @description `1rem` // `16 * 1 = 16px` | ||
*/ | ||
"2xl": "1rem", | ||
/** | ||
* @description `1.5rem` // `16 * 1.5 = 24px` | ||
*/ | ||
"3xl": "1.5rem", | ||
/** | ||
* @description `9999px` | ||
*/ | ||
full: "9999px", | ||
}; |
Oops, something went wrong.