feat: píx feito, faltando somente estilizar

This commit is contained in:
Adilson Fernando Neves Ornellas 2023-01-27 13:48:12 -03:00
parent 32629e54a2
commit 6e0250dbf9
5 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,45 @@
import React from 'react';
import {useProduct} from 'vtex.product-context';
import './styles.css';
const pixCustom = () => {
const productContextValue = useProduct()
// {productContextValue?.product?.priceRange.sellingPrice.highPrice}
const valorString = productContextValue?.product?.priceRange.sellingPrice.lowPrice;
const valorNumber = Number(valorString)
const desconto = 0.9
var pix = (valorNumber * desconto).toFixed(2).replace(".", ",")
console.log(pix);
return(
<div>
<div>
<img src="https://agenciamagma.vtexassets.com/arquivos/AdilsonFernandoNevesOrnellas-ImgPix.png" alt="Imagem Pix" />
</div>
<div>
<div>
</div>
<div>
<h1> R$ ${pix} </h1>
<h2> 10% de desconto </h2>
</div>
</div>
</div>
);
}
export default pixCustom

View File

@ -0,0 +1,3 @@
[class*=""] {
}

3
react/pixCustom.ts Normal file
View File

@ -0,0 +1,3 @@
import pixCustom from "./components/pixCustom/pixCustom";
export default pixCustom;

View File

@ -125,6 +125,7 @@
"flex-layout.row#selling-price",
// "flex-layout.row#list-price-savings",
"product-installments#custom",
"pixCustom",
"sku-selector",
"html#quantidadeEButtonCustom",
// "product-separator",

View File

@ -5,5 +5,8 @@
"html": {
"component": "html",
"composition": "children"
},
"pixCustom": {
"component": "pixCustom"
}
}