import type { HTMLAttributes } from 'react' import React, { forwardRef } from 'react' import { Icon, IconButton, type IconButtonProps, ProductPrice, QuantitySelector, } from '../../' import type { PriceDefinition } from '../../typings/PriceDefinition' export interface CartItemProps extends HTMLAttributes { /** * ID to find this component in testing tools (e.g.: Cypress, Testing Library, and Jest). */ testId?: string /** * Specifies product Price. */ price?: PriceDefinition /** * Specifies the quantity of items of the same product. */ quantity?: number /** * Controls by how many units the value advances **/ unitMultiplier?: number /** * Controls wheter you use or not the unitMultiplier */ useUnitMultiplier?: boolean /** * Specifies that this product is unavailable. */ unavailable?: boolean /** * Props for the Remove from cart IconButton component. */ removeBtnProps?: Partial /** * Event emitted when product quantity value is changed. */ onQuantityChange?: (value: number) => void } const CartItem = forwardRef(function CartItem( { testId = 'fs-cart-item', price, quantity, unavailable, onQuantityChange, unitMultiplier, useUnitMultiplier, children, removeBtnProps, ...otherProps }, ref ) { return (
{children}
} aria-label="Remove" {...removeBtnProps} />
) }) export default CartItem