interface ProductItem {
  name: string;
  spec: string;
  price: string;
  qty: number;
  image:string;
}

interface Props {
  items: ProductItem[];
}

export default function ProductList({ items }: Props) {
  return (
    <div className="mb-6 space-y-4">
      {items.map((item, index) => (
        <div className="flex items-center justify-between gap-3" key={index}>
          {item.image ? (
            <img
              src={item.image}
              alt={item.name}
              className="w-22.5 h-23 object-cover rounded shrink-0"
            />
          ) : (
            <div className="w-31 h-23 bg-gray-100 rounded shrink-0"></div>
          )}

          <div>
            <p className="font-medium">{item.name}</p>
            <p className="text-sm text-gray-600 my-1">{item.spec}</p>
            <div className="flex justify-between">
              <span>{item.price}</span>
              <span>X {item.qty}</span>
            </div>
          </div>
        </div>
      ))}
    </div>
  );
}
