challenge-vtex-io-izabela-b.../react/components/Pix/Pix.tsx

31 lines
743 B
TypeScript
Raw Normal View History

2023-02-03 22:49:19 +00:00
import React from "react";
import { useProduct } from "vtex.product-context";
2023-02-03 22:49:19 +00:00
const Pix = () => {
const productContextValue = useProduct()?.product?.priceRange?.sellingPrice
?.highPrice;
2023-02-03 22:49:19 +00:00
return (
<>
2023-02-10 01:54:10 +00:00
<div className="pix-container">
<div className="pix-img">
<img
src="https://agenciamagma.vtexassets.com/arquivos/pix_izabela.svg"
alt="Pix"
/>
</div>
<div className="pix-preco">
{`R$ ${(productContextValue! - productContextValue! * 0.1)
.toFixed(2)
.replace(".", ",")}`}
2023-02-10 03:19:11 +00:00
<div className="pix-p">
2023-02-11 00:28:44 +00:00
<p>10% de desconto</p>
2023-02-10 03:19:11 +00:00
</div>
2023-02-10 01:54:10 +00:00
</div>
</div>
2023-02-03 22:49:19 +00:00
</>
);
};
2023-02-03 22:49:19 +00:00
export default Pix;