2023-01-29 18:46:45 +00:00
|
|
|
import React from "react";
|
|
|
|
import { useProduct } from "vtex.product-context";
|
|
|
|
import styles from "./Pix.module.css";
|
|
|
|
|
|
|
|
const Pix = () => {
|
2023-01-30 22:25:05 +00:00
|
|
|
if (typeof document !== "undefined") {
|
2023-01-30 02:09:01 +00:00
|
|
|
const input = document.querySelector(".vtex-address-form-4-x-input");
|
|
|
|
input?.setAttribute("placeholder", "Digite seu CEP");
|
|
|
|
}
|
|
|
|
|
2023-01-29 18:46:45 +00:00
|
|
|
const price = useProduct()?.product?.priceRange?.sellingPrice?.highPrice;
|
|
|
|
const discount = (Number(price) * 10) / 100;
|
|
|
|
const priceWithDiscount = Number(price) - Number(discount);
|
|
|
|
return (
|
|
|
|
<div className={styles.containerPix}>
|
|
|
|
<img
|
2023-01-30 02:09:01 +00:00
|
|
|
className={styles.image}
|
2023-01-29 18:46:45 +00:00
|
|
|
src="https://agenciamagma.vtexassets.com/arquivos/pix-cainamilech.png"
|
|
|
|
alt="Imagem do pix"
|
|
|
|
/>
|
2023-01-30 02:09:01 +00:00
|
|
|
<div className={styles.texts}>
|
|
|
|
<p className={styles.price}>
|
|
|
|
R$ {priceWithDiscount.toFixed(2).replace(".", ",")}
|
|
|
|
</p>
|
|
|
|
<p className={styles.discount}>10 % de desconto</p>
|
2023-01-29 18:46:45 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Pix;
|