Merge pull request 'feat: substitui ponto por virgula valor pix' (#14) from feature/substitui-ponto-por-virgula-valor-pix into development

Reviewed-on: #14
This commit is contained in:
Rafael Sampaio de Oliveira 2023-01-30 14:46:04 +00:00
commit 4058a2b0b9

View File

@ -1,15 +1,15 @@
import React from "react"; import React, { useEffect } from "react";
import { useProduct } from "vtex.product-context"; import { useProduct } from "vtex.product-context";
import styles from "./styles.module.css"; import styles from "./styles.module.css";
const PixPrice = () => { const PixPrice = () => {
// useEffect(() => { useEffect(() => {
// const inputCep = document.querySelectorAll(".vtex-address-form-4-x-input"); const inputCep = document.querySelectorAll(".vtex-address-form-4-x-input");
// // inputCep.setAttribute('placeholder', 'Digite seu CEP'); // inputCep.setAttribute('placeholder', 'Digite seu CEP');
// console.log(inputCep); console.log(inputCep);
// }); });
const productContextValue = useProduct(); const productContextValue = useProduct();
@ -18,7 +18,7 @@ const PixPrice = () => {
const descount = (Number(productPrice) * 10) / 100; const descount = (Number(productPrice) * 10) / 100;
const total = Number(productPrice) - Number(descount.toFixed(2)); const total = Number(productPrice) - Number(descount);
return ( return (
<div className={styles["pixPrice-container"]}> <div className={styles["pixPrice-container"]}>
@ -30,7 +30,9 @@ const PixPrice = () => {
/> />
</div> </div>
<div className={styles["pixPrice-descount"]}> <div className={styles["pixPrice-descount"]}>
<p className={styles["pixPrice-value"]}>R$ {total.toFixed(2)}</p> <p className={styles["pixPrice-value"]}>
R$ {total.toFixed(2).replace(".", ",")}
</p>
<p className={styles["pixPrice-text"]}>10 % de desconto</p> <p className={styles["pixPrice-text"]}>10 % de desconto</p>
</div> </div>
</div> </div>