import styles from "./styles.module.scss"
import Link from 'next/link'

export type ImageCardProps = {
  src: string,
  title: string,
  href?: string
}

export const ImageCard = ({src, title, href}: ImageCardProps) => {
  const card = (
    <div className={styles.container} style={{ backgroundImage: `url(${encodeURI(src)})` }}>
      <div className={styles.title}>
        {title}
      </div>
    </div>
  )

  return href ? <Link href={href}>{card}</Link> : card
}
