import cn from 'clsx'; import Link from 'next/link'; import { FC } from 'react'; import s from './CartSidebarView.module.css'; import CartItem from '../CartItem'; import { Button, Text } from '@components/ui'; import { useUI } from '@components/ui/context'; import { Bag, Cross, Check } from '@components/icons'; import useCart from '@framework/cart/use-cart'; import usePrice from '@framework/product/use-price'; import SidebarLayout from '@components/common/SidebarLayout'; const CartSidebarView: FC = () => { const { closeSidebar, setSidebarView } = useUI(); const { data, isLoading, isEmpty } = useCart(); const { price: subTotal } = usePrice( data && { amount: Number(data.subtotalPrice), currencyCode: data.currency.code, } ); const { price: total } = usePrice( data && { amount: Number(data.totalPrice), currencyCode: data.currency.code, } ); const handleClose = () => closeSidebar(); const goToCheckout = () => setSidebarView('CHECKOUT_VIEW'); const error = null; const success = null; return ( {isLoading || isEmpty ? (

Your cart is empty

Biscuit oat cake wafer icing ice cream tiramisu pudding cupcake.

) : error ? (

We couldn’t process the purchase. Please check your card information and try again.

) : success ? (

Thank you for your order.

) : ( <>
My Cart
Total {total}
{process.env.COMMERCE_CUSTOMCHECKOUT_ENABLED ? ( ) : ( )}
)}
); }; export default CartSidebarView;