ai-flash-card / src / components / card.js
card.js
Raw
export default function Card({
  title,
  description,
  image,
  gameUrl,
  buttonText,
}) {
  return (
    <div className="max-w-sm w-full h-96 bg-white border border-gray-200 rounded-lg shadow dark:bg-gray-800 dark:border-gray-700 m-4">
      <a href={gameUrl ? gameUrl : "#"}>
        <img
          className="w-full h-48 object-cover rounded-t-lg"
          src={image ? image : "https://via.placeholder.com/300"}
          alt={title ? title : "Card"}
        />
      </a>
      <div className="p-5">
        <a href={gameUrl ? gameUrl : "#"}>
          <h5 className="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">
            {title}
          </h5>
        </a>
        <p className="mb-3 font-normal text-gray-700 dark:text-gray-400">
          {description}
        </p>
        <a
          href={gameUrl ? gameUrl : "#"}
          className="inline-flex items-center px-3 py-2 text-sm font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
        >
          {buttonText ? buttonText : "Play Now"}
          <svg
            className="rtl:rotate-180 w-3.5 h-3.5 ms-2"
            aria-hidden="true"
            xmlns="http://www.w3.org/2000/svg"
            fill="none"
            viewBox="0 0 14 10"
          >
            <path
              stroke="currentColor"
              strokeLinecap="round"
              strokeLinejoin="round"
              strokeWidth="2"
              d="M1 5h12m0 0L9 1m4 4L9 9"
            />
          </svg>
        </a>
      </div>
    </div>
  );
}