import { Area } from '@components/common/Area.js'; import { Image } from '@components/common/Image.js'; import { ProductNoThumbnail } from '@components/common/ProductNoThumbnail.js'; import { useCatalogImageDimensions } from '@components/common/useCatalogImageDimensions.js'; import { CartItem } from '@components/frontStore/cart/CartContext.js'; import { ItemQuantity } from '@components/frontStore/cart/ItemQuantity.js'; import { _ } from '@evershop/evershop/lib/locale/translate/_'; import { deriveProductImageSize } from '@evershop/evershop/lib/util/deriveProductImageSize'; import { Minus, Plus, Trash2 } from 'lucide-react'; import React from 'react'; interface CartItemsTableProps { items: CartItem[]; showPriceIncludingTax?: boolean; loading?: boolean; onSort?: (key: string, direction: 'asc' | 'desc') => void; currentSort?: { key: string; direction: 'asc' | 'desc' }; onRemoveItem?: (itemId: string) => Promise; } /** * Re-skin (2026-07-10): a flex line-item list matching the reference — 96px * bordered thumbnail, then a content block with name/SKU/variant + line total * on the top row and the qty stepper + Remove on the bottom row, items divided * by rules. (Was a 3-column ExtendableTable.) */ export const DefaultCartItemList: React.FC = ({ items, showPriceIncludingTax = true, loading = false, onRemoveItem }) => { // Fixed 96px square display (h-24 w-24 + object-cover); base 200 keeps it sharp on retina. const thumbSize = deriveProductImageSize(200, useCatalogImageDimensions()); return ( <>
{items.map((row) => { const totalValue = showPriceIncludingTax ? row.lineTotalInclTax?.text : row.lineTotal?.text; return (
{row.thumbnail ? ( {row.productName} ) : ( )}
{row.productName}
{_('SKU ${sku}', { sku: row.productSku })}
{row.variantOptions?.map((option) => (
{option.attributeName}: {option.optionText}
))} {row.errors?.map((error, index) => (
{error}
))}
{totalValue}
{({ quantity, increase, decrease }) => (
{quantity}
)}
); })}
); };