2023-02-01 01:16:13 +00:00
|
|
|
import React from "react";
|
2023-02-01 23:50:50 +00:00
|
|
|
import { useProduct } from "vtex.product-context";
|
|
|
|
import { useCssHandles } from "vtex.css-handles";
|
2023-02-01 01:16:13 +00:00
|
|
|
|
2023-02-01 23:50:50 +00:00
|
|
|
const Pix = () => {
|
|
|
|
const productContextValue = useProduct();
|
|
|
|
const price = productContextValue?.product?.priceRange.listPrice.highPrice;
|
|
|
|
|
|
|
|
console.log(productContextValue);
|
|
|
|
|
|
|
|
console.log(price);
|
|
|
|
let pix;
|
|
|
|
let valuePix;
|
|
|
|
|
|
|
|
if (price !== undefined) {
|
|
|
|
pix = (price / 100) * 10;
|
|
|
|
console.log(pix, "valor lido");
|
|
|
|
valuePix = price - pix;
|
|
|
|
console.log(valuePix);
|
|
|
|
}
|
|
|
|
|
|
|
|
const CSS_HANDLES = [
|
|
|
|
'imagePix',
|
|
|
|
'textPix'
|
|
|
|
]
|
|
|
|
|
|
|
|
const handles = useCssHandles(CSS_HANDLES)
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<img
|
|
|
|
className={handles.}
|
|
|
|
alt="imagem pix"
|
|
|
|
src="https://agenciamagma.vteximg.com.br/arquivos/pix.png"
|
|
|
|
/>
|
|
|
|
<p>R$ {valuePix}</p>
|
|
|
|
</div>
|
|
|
|
);
|
2023-02-01 01:16:13 +00:00
|
|
|
};
|
|
|
|
|
2023-02-01 23:50:50 +00:00
|
|
|
export default Pix;
|