Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | 8x 8x 8x 8x 14x 14x 14x 14x 14x 14x 14x 8x | import React, { Fragment, FunctionComponent } from 'react';
import { withCurrency, TranslatedString, WithCurrencyProps } from '../locale';
import OrderSummaryPrice from './OrderSummaryPrice';
export interface OrderSummaryTotalProps {
orderAmount: number;
shopperCurrencyCode: string;
storeCurrencyCode: string;
}
const OrderSummaryTotal: FunctionComponent<OrderSummaryTotalProps & WithCurrencyProps> = ({
shopperCurrencyCode,
storeCurrencyCode,
orderAmount,
currency,
}) => {
const hasDifferentCurrency = shopperCurrencyCode !== storeCurrencyCode;
const label = <Fragment>
{ hasDifferentCurrency ?
<TranslatedString id="cart.estimated_total_text" /> :
<TranslatedString id="cart.total_text" /> }
{ ` (${shopperCurrencyCode})` }
</Fragment>;
return (
<Fragment>
<OrderSummaryPrice
amount={ orderAmount }
className="cart-priceItem--total"
label={ label }
superscript={ hasDifferentCurrency ? '*' : undefined }
testId="cart-total"
/>
{ hasDifferentCurrency && currency && <p
className="cart-priceItem--totalNote"
data-test="cart-price-item-total-note"
>
<TranslatedString
data={ {
total: currency.toStoreCurrency(orderAmount),
code: storeCurrencyCode,
} }
id="cart.billed_amount_text"
/>
</p> }
</Fragment>
);
};
export default withCurrency(OrderSummaryTotal);
|