import React, { useContext } from "react"
import styles from '../styles/styles.module.css'
import noImage from '../assets/no-image.jpg'
import { ProductContext } from "../context/ProductContext"

export interface Props {
  className?: string
}
export const ProductImage = ({ className } : Props) => {
  const { product: { img } } = useContext(ProductContext)
  return (
    <img className={`${styles.productImg} ${className}`} src={img ? img : noImage} alt="Product Image" />
  )
}