summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src-migrate/modules/product-detail/components/PriceAction.tsx29
1 files changed, 18 insertions, 11 deletions
diff --git a/src-migrate/modules/product-detail/components/PriceAction.tsx b/src-migrate/modules/product-detail/components/PriceAction.tsx
index 0a9cb2df..f8591b3a 100644
--- a/src-migrate/modules/product-detail/components/PriceAction.tsx
+++ b/src-migrate/modules/product-detail/components/PriceAction.tsx
@@ -66,17 +66,21 @@ const PriceAction = ({ product }: Props) => {
setQuantityInput('1');
}, [selectedVariant]);
- let voucherPastiHemat = 0;
+ const price = activePrice?.price_discount || activePrice?.price || 0;
+ const pricedigit = String(Math.floor(price)).length;
+ const fontSize = pricedigit > 9 ? '20px' : undefined;
- if (
- product?.voucher_pasti_hemat
- ? product?.voucher_pasti_hemat.length
- : voucherPastiHemat > 0
- ) {
- const stringVoucher = product?.voucher_pasti_hemat[0];
- const validJsonString = stringVoucher.replace(/'/g, '"');
- voucherPastiHemat = JSON.parse(validJsonString);
- }
+ // let voucherPastiHemat = 0;
+
+ // if (
+ // product?.voucher_pasti_hemat
+ // ? product?.voucher_pasti_hemat.length
+ // : voucherPastiHemat > 0
+ // ) {
+ // const stringVoucher = product?.voucher_pasti_hemat[0];
+ // const validJsonString = stringVoucher.replace(/'/g, '"');
+ // voucherPastiHemat = JSON.parse(validJsonString);
+ // }
return (
<div
@@ -100,7 +104,10 @@ const PriceAction = ({ product }: Props) => {
</div>
</>
)}
- <div className={style['main-price']}>
+ <div
+ className={style['main-price']}
+ style={fontSize ? { fontSize } : undefined}
+ >
Rp {formatCurrency(activePrice.price_discount || 0)}
</div>
</div>