import { useNavigate } from 'react-router-dom';
import { languageObject } from '../Utils/languageObject';

const ProductCard = ({data}:any) => {

    const navigate = useNavigate();
    const productLink = `/product/${data?.id}` 
    console.log(data);
    
  return (
    <div className="product_card">
       <div className="image_container">
        <img
          onClick={() => navigate(productLink)}
          src={data?.file}
          alt={`product ${data.name}`}
          />
       </div>
    <p className="truncate-text">{languageObject(data?.name)}</p>
  </div>
  )
}

export default ProductCard