(props: IAnime)
| 3 | import { IAnime } from '../App'; |
| 4 | |
| 5 | export const AnimeCard = (props: IAnime) => { |
| 6 | let cardColor = 'bg-red-400'; |
| 7 | if (props.score >= 6.9) { |
| 8 | cardColor = 'bg-yellow-400'; |
| 9 | } |
| 10 | if (props.score >= 7.9) { |
| 11 | cardColor = 'bg-green-400'; |
| 12 | } |
| 13 | |
| 14 | const cardClass = `flex rounded-lg ${cardColor} text-black shadow-xl `; |
| 15 | |
| 16 | const favoriteShow = () => { |
| 17 | props.setFavorites([ |
| 18 | ...props.favorites, |
| 19 | { |
| 20 | image_url: props.image_url, |
| 21 | title: props.title, |
| 22 | score: props.score, |
| 23 | episodes: props.episodes, |
| 24 | synopsis: props.synopsis, |
| 25 | }, |
| 26 | ]); |
| 27 | }; |
| 28 | |
| 29 | return ( |
| 30 | <div key={props.i} className={cardClass} onClick={favoriteShow}> |
| 31 | <img src={props.image_url} alt="" className="w-36 rounded-l-lg " /> |
| 32 | <div className="p-4 w-full rounded-lg flex place-items-center my-2"> |
| 33 | <div className="flex flex-col space-y-2 "> |
| 34 | <div className=" font-bold h-full flex place-items-center text-left justify-between"> |
| 35 | <div className="text-2xl w-64">{props.title}</div> |
| 36 | <div className="border-2 border-black w-12 h-10 rounded-lg flex place-items-center "> |
| 37 | <div className="text-xl text-center w-full">{Math.round(props.score * 10) / 10}</div> |
| 38 | </div> |
| 39 | </div> |
| 40 | <div className="text-sm font-medium text-left">{props.synopsis}</div> |
| 41 | </div> |
| 42 | </div> |
| 43 | </div> |
| 44 | ); |
| 45 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected