diff --git a/src/components/castCard/castCard.tsx b/src/components/castCard/castCard.tsx new file mode 100644 index 0000000..efbecc6 --- /dev/null +++ b/src/components/castCard/castCard.tsx @@ -0,0 +1,28 @@ +import React from 'react'; +import Image from 'next/image'; + +interface ICastCard { + name: string; + character: string; + profile_path: string; +} + +const CastCard: React.FC = ({ name, character, profile_path }) => { + return ( +
+ {name} +
+

{name}

+

{character}

+
+
+ ); +}; + +export default CastCard; diff --git a/src/components/topCast/topCast.tsx b/src/components/topCast/topCast.tsx new file mode 100644 index 0000000..01a7c80 --- /dev/null +++ b/src/components/topCast/topCast.tsx @@ -0,0 +1,27 @@ +import React from 'react'; +import Image from 'next/image'; +import { Cast } from '@/constant/detailMovie'; +import CastCard from '../castCard/castCard'; + +interface ITopCast { + cast: Cast[]; +} + +const TopCast: React.FC = ({ cast }) => { + return ( +
+

Top Casts

+
+ {cast.slice(0, 12).map((cast, index) => ( + + ))} +
+
+ ); +}; + +export default TopCast; diff --git a/src/modules/detailMovie/detailMovie.tsx b/src/modules/detailMovie/detailMovie.tsx index 0ba792c..16d23e2 100644 --- a/src/modules/detailMovie/detailMovie.tsx +++ b/src/modules/detailMovie/detailMovie.tsx @@ -10,6 +10,7 @@ import Rating from '@/components/rating/rating'; import Genres from '@/components/genres/genres'; import YearRuntime from '@/components/yearRuntime/yearRuntime'; import CrewList from '@/components/crewList/crewList'; +import TopCast from '@/components/topCast/topCast'; interface IDetailMovieModule { id: string; @@ -54,55 +55,32 @@ const DetailMovieModule: React.FC = ({ id }) => { onLoad={() => setIsLoading(false)} /> - {movie && ( -
- {/* poster */} - {movie?.title} +
+ {/* poster */} + {movie?.title} -
- -

{movie.title}

-

{movie.overview}

- - -
+
+ +

{movie.title}

+

{movie.overview}

+ +
- )} +
- - {/* casts */} -
-

Top Casts

-
- {movie.credits.cast.slice(0, 12).map((cast, index) => ( -
- {cast.name} -
-

{cast.name}

-

{cast.character}

-
-
- ))} -
-
+ ); };