From 48b484011dc1bf406f8239ecf53749ff9a939928 Mon Sep 17 00:00:00 2001 From: okbel Date: Tue, 19 Jan 2021 12:33:50 -0300 Subject: [PATCH] More updates --- components/cart/CartItem/CartItem.tsx | 2 ++ .../cart/CartSidebarView/CartSidebarView.tsx | 6 ++--- .../product/ProductCard/ProductCard.tsx | 2 +- framework/bigcommerce/cart/use-cart.tsx | 21 ++++++++------- framework/bigcommerce/lib/immutability.ts | 18 +++++++++++++ framework/bigcommerce/lib/normalize.ts | 17 ++++-------- framework/types.d.ts | 3 ++- pages/cart.tsx | 26 ++++++------------- pages/search.tsx | 12 ++++----- 9 files changed, 57 insertions(+), 50 deletions(-) create mode 100644 framework/bigcommerce/lib/immutability.ts diff --git a/components/cart/CartItem/CartItem.tsx b/components/cart/CartItem/CartItem.tsx index 14bd10c94..91a70af0b 100644 --- a/components/cart/CartItem/CartItem.tsx +++ b/components/cart/CartItem/CartItem.tsx @@ -12,6 +12,7 @@ import useRemoveItem from '@framework/cart/use-remove-item' const Item = ({ item, currencyCode, + ...rest }: { item: CartItem currencyCode: string @@ -79,6 +80,7 @@ const Item = ({ className={cn('flex flex-row space-x-8 py-8', { 'opacity-75 pointer-events-none': removing, })} + {...rest} >
{ const { price: subTotal } = usePrice( data && { - amount: data.subTotal, + amount: Number(data.subTotal), currencyCode: data.currency?.code || 'USD', } ) const { price: total } = usePrice( data && { - amount: data.total, + amount: Number(data.total), currencyCode: data.currency?.code || 'USD', } ) @@ -94,7 +94,7 @@ const CartSidebarView: FC = () => { My Cart