import Link from "next/link";
import { formatPrice } from "@/lib/utils";

export default function CartItem({item}:any) {
    return(
        <div className="cart-item">
            <Link href={item.productUrl} className="cart-img">
                <img 
                    src={item.productImage.small} 
                    alt={item.productName} 
                    width={100} 
                    height={100} 
                />
            </Link>

            <div className="cart-text">
                <Link href={item.productUrl} className="d-block font-700" style={{ marginBottom: "5px" }}>
                    {item.productName}
                </Link>

                <p className="m-0 d-flex justify-content-between">
                    <b>x{item.cartQuantity}</b>
                    <b className="red">
                        {item.price > 0 ? formatPrice(item.price) +'đ' : 'Liên hệ'} 
                    </b>
                </p>
            </div>
        </div>
    )
}