diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-10-27 10:18:32 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-10-27 10:18:32 +0700 |
| commit | c812f260ceb99df4c8904bad5a9cece0badccfcd (patch) | |
| tree | 0b5458c4c571dc20bd205325537c586846bb64fd | |
| parent | 3a4598bbbb4a0b13800442b51b5a9842f37bb1ff (diff) | |
<MIqdad> fix price prod detail
| -rw-r--r-- | src-migrate/modules/product-detail/components/PriceAction.tsx | 29 |
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> |
