forked from M3-Academy/challenge-vtex-io
28 lines
787 B
TypeScript
28 lines
787 B
TypeScript
import React from "react";
|
|
import { useProduct } from "vtex.product-context";
|
|
import styles from "./styles.css";
|
|
|
|
const InstallmentProduct = () => {
|
|
const product = useProduct();
|
|
const productWithInstallments = {
|
|
numberOfInstallments:
|
|
product?.selectedItem?.sellers[0].commertialOffer.Installments[3]
|
|
.NumberOfInstallments,
|
|
value:
|
|
product?.selectedItem?.sellers[0].commertialOffer.Installments[3].Value,
|
|
};
|
|
return (
|
|
<p className={styles.PriceContent}>
|
|
<strong>{productWithInstallments.numberOfInstallments}x </strong>
|
|
de
|
|
<strong>
|
|
R$
|
|
{productWithInstallments.value?.toFixed(2).toString().replace(".", ",")}
|
|
</strong>{" "}
|
|
sem juros
|
|
</p>
|
|
);
|
|
};
|
|
|
|
export default InstallmentProduct;
|