-
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 #43 from victorverma3/movie-cards
Redesigned movie recommendation display
- Loading branch information
Showing
6 changed files
with
89 additions
and
171 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
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,47 @@ | ||
import { Link } from "react-router-dom"; | ||
|
||
interface MovieCardProps { | ||
title: string; | ||
poster: string; | ||
release_year: number; | ||
predicted_rating: number; | ||
url: string; | ||
} | ||
|
||
const MovieCard = ({ | ||
title, | ||
poster, | ||
release_year, | ||
predicted_rating, | ||
url, | ||
}: MovieCardProps) => { | ||
return ( | ||
<div className="w-48 mt-4 flex flex-col border-2 border-gray-200 rounded-lg duration-200 hover:scale-105 hover:transition hover:border-amber-800 hover:shadow-lg"> | ||
<Link | ||
to={url} | ||
target="_blank" | ||
className="h-full flex flex-col justify-between" | ||
> | ||
<img | ||
className="w-full rounded-md" | ||
src={poster} | ||
alt="error displaying poster" | ||
/> | ||
<div className="p-2 flex flex-col flex-1 justify-between"> | ||
<h2 className="text-md text-left"> | ||
<span className="text-amber-800 font-semibold"> | ||
{title}{" "} | ||
</span> | ||
({release_year}) | ||
</h2> | ||
<h3 className="text-sm text-left text-black"> | ||
Predicted Rating:{" "} | ||
<span className="font-bold">{predicted_rating}</span> | ||
</h3> | ||
</div> | ||
</Link> | ||
</div> | ||
); | ||
}; | ||
|
||
export default MovieCard; |
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,31 @@ | ||
import MovieCard from "./MovieCard"; | ||
|
||
type RecommendationResponse = { | ||
title: string; | ||
poster: string; | ||
release_year: number; | ||
predicted_rating: number; | ||
url: string; | ||
}; | ||
|
||
interface RecDisplayProps { | ||
recommendations: RecommendationResponse[]; | ||
} | ||
|
||
const RecDisplay = ({ recommendations }: RecDisplayProps) => { | ||
return ( | ||
<div className="w-fit max-w-5xl flex flex-wrap justify-around"> | ||
{recommendations.map((rec) => ( | ||
<MovieCard | ||
title={rec.title} | ||
poster={rec.poster} | ||
release_year={rec.release_year} | ||
predicted_rating={rec.predicted_rating} | ||
url={rec.url} | ||
/> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default RecDisplay; |
This file was deleted.
Oops, something went wrong.
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