import React, { forwardRef } from 'react' import type { HTMLAttributes } from 'react' import { Label, List } from '../../' export interface OrderSummaryProps extends HTMLAttributes { /** * ID to find this component in testing tools (e.g., cypress, * testing-library, and jest). */ testId?: string /** * Label for the subtotal value of the order. It will only show if subtotalValue is provided. */ subtotalLabel?: string /** * Subtotal value of the order. If provided, a subtotal label and value will be shown. */ subtotalValue?: string /** * Label for the discount value for the order. It will only show if discountValue is provided. */ discountLabel?: string /** * Discount value for the order. If provided, a discount label and value will be shown. */ discountValue?: string /** * Label for the total value of the order. */ totalLabel?: string /** * Total value of the order. */ totalValue?: string /** * Specifies whether the displayed price should include taxes. */ includeTaxes?: boolean /** * Label to determine if the price includes taxes. */ includeTaxesLabel?: string } const OrderSummary = forwardRef( function OrderSummary( { testId = 'fs-order-summary', subtotalLabel, subtotalValue, discountLabel = 'Discount', discountValue, totalLabel = 'Total', totalValue, includeTaxes = false, includeTaxesLabel = 'Tax included', ...otherProps }, ref ) { return ( {subtotalValue ? (
  • {subtotalLabel} {subtotalValue}
  • ) : null} {discountValue ? (
  • {discountLabel} {discountValue}
  • ) : null}
  • {totalLabel} {totalValue}
  • {includeTaxes && (
  • )}
    ) } ) export default OrderSummary