From 58ab91f8a99a79e0dbae33cf71830e4d1646e264 Mon Sep 17 00:00:00 2001
From: Rafi Zadanly <zadanlyr@gmail.com>
Date: Mon, 20 Feb 2023 12:00:29 +0700
Subject: cart refactor

---
 src/lib/cart/components/Cart.jsx | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

(limited to 'src/lib/cart/components/Cart.jsx')

diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx
index 69b4ded4..0b6ea768 100644
--- a/src/lib/cart/components/Cart.jsx
+++ b/src/lib/cart/components/Cart.jsx
@@ -204,7 +204,10 @@ const Cart = () => {
       <div className="sticky bottom-0 left-0 w-full p-4 mt-6 border-t border-gray_r-6 bg-white">
         <div className="flex justify-between mb-4">
           <div className="text-gray_r-11">
-            Total: <span className="text-red_r-11 font-semibold">{ currencyFormat(totalPriceBeforeTax - totalDiscountAmount + totalTaxAmount) }</span>
+            Total: 
+            <span className="text-red_r-11 font-semibold">
+              { selectedProduct().length > 0 ? currencyFormat(totalPriceBeforeTax - totalDiscountAmount + totalTaxAmount) : ' - ' }
+            </span>
           </div>
         </div>
         <div className="flex gap-x-3">
@@ -235,20 +238,20 @@ const Cart = () => {
         <div className="leading-7 text-gray_r-12/80">
           Apakah anda yakin menghapus barang <span className="underline">{deleteConfirmation?.name}</span> dari keranjang?
         </div>
-        <div className="flex mt-6 mb-2 gap-x-4">
+        <div className="flex mt-6 gap-x-4">
           <button 
-            className="btn-light flex-1" 
+            className="btn-solid-red flex-1" 
             type="button"
-            onClick={() => setDeleteConfirmation(null)}
+            onClick={() => deleteProduct(deleteConfirmation?.id)}
           >
-            Batal
+            Ya, Hapus
           </button>
           <button 
-            className="btn-solid-red flex-1" 
+            className="btn-light flex-1" 
             type="button"
-            onClick={() => deleteProduct(deleteConfirmation?.id)}
+            onClick={() => setDeleteConfirmation(null)}
           >
-            Ya, Hapus
+            Batal
           </button>
         </div>
       </BottomPopup>
-- 
cgit v1.2.3

