|
| 1 | +import React from 'react'; |
| 2 | +import { FaBook, FaGamepad, FaFilm, FaNewspaper, FaArrowRight, FaMusic } from 'react-icons/fa'; |
| 3 | + |
| 4 | +const categoryIcons = { |
| 5 | + Book: <FaBook />, |
| 6 | + Game: <FaGamepad />, |
| 7 | + Movie: <FaFilm />, |
| 8 | + Article: <FaNewspaper />, |
| 9 | + Music: <FaMusic />, |
| 10 | +}; |
| 11 | + |
| 12 | +const categoryStyles = { |
| 13 | + Book: { |
| 14 | + backgroundColor: 'rgba(59, 130, 246, 0.1)', |
| 15 | + borderColor: 'rgba(59, 130, 246, 0.5)', |
| 16 | + }, |
| 17 | + Movie: { |
| 18 | + backgroundColor: 'rgba(239, 68, 68, 0.1)', |
| 19 | + borderColor: 'rgba(239, 68, 68, 0.5)', |
| 20 | + }, |
| 21 | + Game: { |
| 22 | + backgroundColor: 'rgba(34, 197, 94, 0.1)', |
| 23 | + borderColor: 'rgba(34, 197, 94, 0.5)', |
| 24 | + }, |
| 25 | + Article: { |
| 26 | + backgroundColor: 'rgba(249, 115, 22, 0.1)', |
| 27 | + borderColor: 'rgba(249, 115, 22, 0.5)', |
| 28 | + }, |
| 29 | + Music: { |
| 30 | + backgroundColor: 'rgba(168, 85, 247, 0.1)', |
| 31 | + borderColor: 'rgba(168, 85, 247, 0.5)', |
| 32 | + }, |
| 33 | +}; |
| 34 | + |
| 35 | +const LogCard = ({ log }) => { |
| 36 | + const { title, category, author, director, platform, source, artist, link, date, rating } = log; |
| 37 | + |
| 38 | + const cardStyle = categoryStyles[category] || {}; |
| 39 | + |
| 40 | + return ( |
| 41 | + <div |
| 42 | + className="bg-transparent border rounded-lg shadow-lg p-6 flex flex-col justify-between" |
| 43 | + style={cardStyle} |
| 44 | + > |
| 45 | + <div> |
| 46 | + <div className="flex items-center justify-between mb-4"> |
| 47 | + <div className="flex items-center"> |
| 48 | + <div className="text-2xl mr-4">{categoryIcons[category]}</div> |
| 49 | + <h2 className="text-xl font-bold">{title}</h2> |
| 50 | + </div> |
| 51 | + </div> |
| 52 | + <div className="text-sm text-gray-400 mb-4"> |
| 53 | + {author && <div>Author: {author}</div>} |
| 54 | + {director && <div>Director: {director}</div>} |
| 55 | + {platform && <div>Platform: {platform}</div>} |
| 56 | + {source && <div>Source: {source}</div>} |
| 57 | + {artist && <div>Artist: {artist}</div>} |
| 58 | + </div> |
| 59 | + </div> |
| 60 | + <div className="flex items-center justify-between"> |
| 61 | + <div className="flex items-center"> |
| 62 | + <div className="text-yellow-400"> |
| 63 | + {[...Array(rating)].map((_, i) => ( |
| 64 | + <span key={i}>★</span> |
| 65 | + ))} |
| 66 | + </div> |
| 67 | + <div className="text-gray-400 ml-2">({rating}/5)</div> |
| 68 | + </div> |
| 69 | + {link && ( |
| 70 | + <a href={link} target="_blank" rel="noopener noreferrer" className="text-primary-400 hover:underline flex items-center"> |
| 71 | + Visit <FaArrowRight className="ml-2" /> |
| 72 | + </a> |
| 73 | + )} |
| 74 | + <div className="text-sm text-blue-400">{date}</div> |
| 75 | + </div> |
| 76 | + </div> |
| 77 | + ); |
| 78 | +}; |
| 79 | + |
| 80 | +export default LogCard; |
0 commit comments