import Image from "next/image";
import { Card, ScrollShadow } from "@heroui/react";
import { formatPrice } from "@repo/utils";
import type { OrderLineItem } from "@/lib/orders";
interface Props {
items: OrderLineItem[];
currency: string;
}
function LineItem({
item,
currency,
}: {
item: OrderLineItem;
currency: string;
}) {
return (
{/* Product image */}
{item.imageUrl ? (
) : (
🐾
)}
{/* Item details */}
{item.productName}
{item.variantName}
SKU: {item.sku}
{item.quantity} × {formatPrice(item.unitPrice, currency)}
{formatPrice(item.totalPrice, currency)}
);
}
export function OrderLineItems({ items, currency }: Props) {
const scrollable = items.length > 4;
return (
Items ({items.length})
{scrollable ? (
{items.map((item) => (
))}
) : (
{items.map((item) => (
))}
)}
);
}