import * as React from 'react';
import { translate as _t } from '@assets/js-shop/ShopUtils';
import { Utils } from '@assets/js-shop/cart/Utils';
import { ICartItem } from '@assets/js-shop/GraphQLInterfaces';

interface CartItemPhotoProps {
   item: ICartItem;
}

export function CartItemPhoto(props: CartItemPhotoProps) {
   const item = props.item;

   return (item.product?.photo ?
         <a href={item.product.url} title={_t('zobrazitZbozi')} className="product-image">
            <img src={Utils.getImageUrl(item.product.photo)} alt={item.product.title} className="img-responsive"/>
         </a>
         :
         <span className="product-image"></span>

   );
}
