Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added card component #40

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"dependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-icons": "^5.4.0",
"vite-project": "file:"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useState } from "react";
import "./App.css";
import { Card } from "./components/Card";

function App() {
return (
Expand Down
3 changes: 3 additions & 0 deletions src/components/AnimeCard.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@



29 changes: 29 additions & 0 deletions src/components/Card.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { FaPlaystation } from "react-icons/fa";
import { FaXbox } from "react-icons/fa";
import { FaComputer } from "react-icons/fa6";


export const Card = ({type, title, duration, genre, rating, releaseDate, imgUrl, episodes, platform }) => {
const icons = {
"pc": <FaComputer />,
"xbox": <FaXbox />,
"playstation": <FaPlaystation />
}
return (
<div className="bg-cardBG flex flex-col w-[300px] h-[520px] hover:scale-105 rounded-xl">
<div className="h-3/4 rounded-t-xl w-full">
<img src={imgUrl} alt="Cover Image" className="w-full h-full rounded-t-xl" />
</div>
<div className="h-1/4 flex flex-col p-4">
<p className="text-2xl text-white font-sans">{title}</p>
<p className="text-cardSubtitleColor text-sm">{type}</p>
<div className="w-full flex items-center justify-between">
<p className="text-cardSubtitleColor text-sm">{type==="Movie" && duration+"/"}{type==="Anime" && episodes+" episodes/"} {genre}/ {releaseDate}</p>
<p className={`flex gap-x-1 ${type==="Movie" && "bg-yellow-400 text-[1rem] text-black"} ${type==="Anime" && "bg-yellow-400 text-[1rem] text-black"} ${type==="Game" && "text-xl text-cardSubtitleColor"} px-2 rounded `}>{type==="Movie" && rating}{type==="Anime" && rating}{type==="Game" && platform.map((platform) => icons[platform])}</p>
</div>
</div>
<button className="w-full self-center bg-cardButtonColor hover:bg-cardButtonColor/60 text-white py-2 rounded-b-xl">Add to Profile</button>

</div>
)
}
9 changes: 8 additions & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
export default {
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
theme: {
extend: {},
extend: {
colors: {
cardBG: "#191321",
cardSubtitleColor: "#818181",
cardButtonColor: "#3100d2",
cardButtonHoverColor: "#4d29c4",
}
},
},
plugins: [],
};