interface IProps {
  title: string;
  description: string;
  image: string;
}

const Card = ({ title, description, image }: IProps) => {
  const defaultImgClasses = `w-full h-20 mt-5`;
  const imgClasses = image ? defaultImgClasses : `${defaultImgClasses} hidden`;

  return (
    <div className="mt-5 xl:mt-0 flex flex-1 bg-gradient-to-b from-gold-light to-gold-dark p-0.5 shadow-lg">
      <div className="w-full font-medium flex-col md:px-4 py-1 bg-gradient-to-br from-custom-bglight to-custom-bgdark">
        <object type="image/svg+xml" data={image} className={imgClasses} aria-label={title}></object>
        <h1 className="mt-2 lg:mt-6 text-3xl xl:text-5xl">{title}</h1>
        <h2 className="results-card-content">
          {description.split("\n").map((line, i) => (
            <span key={i}>
              {line}
              <br />
            </span>
          ))}
        </h2>
      </div>
    </div>
  );
};

export default Card;
