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