challenge-vtex-io-emersonfully/react/components/Pix/Pix.tsx

31 lines
799 B
TypeScript
Raw Normal View History

2023-02-06 22:03:44 +00:00
import React from "react";
import { useProduct } from "vtex.product-context";
const Pix = () => {
const productContextValue = useProduct()?.product?.priceRange?.sellingPrice
?.highPrice;
return (
<>
<div className="pix-container">
<div className="pix_img-container">
<img
src="https://agenciamagma.vtexassets.com/arquivos/icon_pix-m3academyemersonfully.png"
alt="Pix"
/>
</div>
<div className="pix_price-container">
{`R$ ${(productContextValue! - productContextValue! * 0.1)
.toFixed(2)
.replace(".", ",")}`}
<div className="pix_discount-container">
2023-02-10 16:44:59 +00:00
<p>10% de desconto</p>
2023-02-06 22:03:44 +00:00
</div>
</div>
</div>
</>
);
};
export default Pix;