From 525166e62b793b351d1a6be2421c0a33b22f7b7b Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 20 Feb 2023 11:35:25 +0700 Subject: cart refactor --- src/core/components/elements/Appbar/Appbar.jsx | 2 +- src/core/components/elements/Popup/BottomPopup.jsx | 2 +- src/lib/cart/components/Cart.jsx | 77 ++++++++++++++++++---- src/lib/product/components/Product.jsx | 2 +- src/styles/globals.css | 4 +- 5 files changed, 68 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/core/components/elements/Appbar/Appbar.jsx b/src/core/components/elements/Appbar/Appbar.jsx index 2a19ec6c..8d060c44 100644 --- a/src/core/components/elements/Appbar/Appbar.jsx +++ b/src/core/components/elements/Appbar/Appbar.jsx @@ -19,7 +19,7 @@ const AppBar = ({ title }) => { - + diff --git a/src/core/components/elements/Popup/BottomPopup.jsx b/src/core/components/elements/Popup/BottomPopup.jsx index e687cf20..5deceadf 100644 --- a/src/core/components/elements/Popup/BottomPopup.jsx +++ b/src/core/components/elements/Popup/BottomPopup.jsx @@ -6,7 +6,7 @@ const BottomPopup = ({ children, active, title, close }) => ( onClick={close} className={`overlay ${active ? 'block' : 'hidden'}`} /> -
+
{ title }
{product?.name}
{ product?.parent?.name } -
{ product.code }
+
+ { product?.code } {product?.attributes.length > 0 ? `| ${product?.attributes.join(', ')}` : ''} +
{ product?.price?.discountPercentage > 0 && (
@@ -149,35 +164,43 @@ const Cart = () => {
- { currencyFormat(product?.price?.priceDiscount * product.quantity) } + { currencyFormat(product?.price?.priceDiscount * product?.quantity) }
updateQuantity(e.target.value, product.id)} - onBlur={(e) => updateQuantity(e.target.value, product.id, 'BLUR')} + type="number" + value={product?.quantity} + onChange={(e) => updateQuantity(e.target.value, product?.id)} + onBlur={(e) => updateQuantity(e.target.value, product?.id, 'BLUR')} /> +
)) }
+
@@ -203,6 +226,32 @@ const Cart = () => {
+ + setDeleteConfirmation(null)} + title="Hapus dari Keranjang" + > +
+ Apakah anda yakin menghapus barang {deleteConfirmation?.name} dari keranjang? +
+
+ + +
+
) } diff --git a/src/lib/product/components/Product.jsx b/src/lib/product/components/Product.jsx index 39d29d4d..92f4e37d 100644 --- a/src/lib/product/components/Product.jsx +++ b/src/lib/product/components/Product.jsx @@ -245,7 +245,7 @@ const Product = ({ product }) => { } const TabButton = ({ children, active, ...props }) => { - const activeClassName = active ? 'text-red_r-11 border-b border-red_r-11' : 'text-gray_r-11' + const activeClassName = active ? 'text-red_r-11 underline underline-offset-4' : 'text-gray_r-11' return (