-
Notifications
You must be signed in to change notification settings - Fork 1
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 group14-aaa/anjal/styling
Anjal/styling
- Loading branch information
Showing
1 changed file
with
45 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,52 @@ | ||
import { Link } from 'react-router-dom'; | ||
|
||
|
||
import { Link } from "react-router-dom"; | ||
import { FcRating } from "react-icons/fc"; | ||
import { MdRateReview } from "react-icons/md"; | ||
import { FaGripfire } from "react-icons/fa6"; | ||
import { FaStarHalfAlt } from "react-icons/fa"; | ||
|
||
const RawgTopRatedGames = ({ gamesList }) => { | ||
return ( | ||
<div className="p-5"> | ||
<h2 className="text-3xl font-bold text-gray-400 mb-4 mt-6 text-center"> | ||
Most Popular Games | ||
</h2> | ||
<div className="flex flex-wrap justify-center"> | ||
|
||
{/* Container for the top games */} | ||
<div className="flex flex-wrap w-full justify-center"> | ||
{gamesList.sort((a, b) => b.rating - a.rating).map((game, index) => index < 24 && ( | ||
<div key={game.id} className="w-full sm:w-1/2 md:w-1/3 lg:w-1/4 xl:w-1/5 bg-secondary rounded overflow-hidden shadow-lg m-4 group hover:scale-110 transition-all duration-300 ease cursor-pointer"> | ||
|
||
{/* Game image */} | ||
<Link to={`/games/${game.id}`}> | ||
<img className="w-full h-40 object-cover" src={game.short_screenshots[0].image} alt={game.name} /> | ||
</Link> | ||
|
||
{/* Game name and rating */} | ||
<div className="px-6 py-4"> | ||
<div className="font-bold text-base mb-2"> | ||
{`${index + 1}. ${game.name}`} | ||
</div> | ||
<p className="text-gray-400 text-sm"> | ||
Rating: {game.rating} | ||
</p> | ||
</div> | ||
return ( | ||
<div className="p-5"> | ||
<h2 className="text-3xl font-bold text-gray-400 mb-4 mt-6 text-center">Top Rated Games</h2> | ||
<div className="flex flex-wrap justify-center"> | ||
{/* Container for the top games */} | ||
<div className="flex flex-wrap w-full justify-center"> | ||
{gamesList | ||
.sort((a, b) => b.rating - a.rating) | ||
.map( | ||
(game, index) => | ||
index < 24 && ( | ||
<div | ||
key={game.id} | ||
className="relative w-full sm:w-1/2 md:w-1/3 lg:w-1/4 xl:w-1/5 bg-secondary rounded overflow-hidden shadow-lg m-4 group hover:scale-110 transition-all duration-300 ease cursor-pointer" | ||
> | ||
<Link to={`/games/${game.id}`}> | ||
<img className="w-full h-40 object-cover" src={game.short_screenshots[0].image} alt={game.name} /> | ||
</Link> | ||
<div className="absolute top-0 right-0 p-2 bg-gray-800 text-white rounded-bl"> | ||
<FcRating alt="MetaCritic Rating" /> {game.metacritic} | ||
</div> | ||
<div className="px-6 py-4"> | ||
<div className="font-bold text-base mb-2">{`${game.name}`}</div> | ||
<div className="flex items-center gap-3 justify-center"> | ||
<p className="text-gray-400 text-sm flex items-center"> | ||
<FaStarHalfAlt alt="The number of ratings" /> {game.rating}{" "} | ||
</p> | ||
<p className="text-gray-400 text-sm flex items-center"> | ||
<MdRateReview alt="The number of reviews" /> {game.reviews_count}{" "} | ||
</p> | ||
<p className="text-gray-400 text-sm flex items-center"> | ||
<FaGripfire alt="Suggestions" /> {game.suggestions_count} | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
)} | ||
</div> | ||
))} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
); | ||
}; | ||
|
||
export default RawgTopRatedGames; |