import React from 'react';
import { useProduct } from 'vtex.product-context';

import styles from './styles.css';

const Pix = () => {

    const productContextValue = useProduct();
    //console.log(productContextValue);

    const price = productContextValue?.product?.priceRange?.sellingPrice?.lowPrice;

    const discount = (Number(price) * (10 / 100));

    const pixValue = (Number(price) - Number(discount));

  return (
    <>
      <img
        className={styles.pixImage}
        src=' https://agenciamagma.vteximg.com.br/arquivos/pix-sabrinamiranda.png'
        alt='Imagem Pix'
      />

      <div className={styles.pixText}>
        <p className={styles.pixPrice}>R$ {pixValue.toFixed(2).replace("." , ",")}</p>
        <p className={styles.pixDiscount}>10 % de desconto</p>
      </div>
    </>
  );
}

export default Pix;
