challenge-vtex-io-josecarlo.../react/components/descont-pix/index.tsx

23 lines
771 B
TypeScript
Raw Normal View History

import React, { FC } from 'react'
import { useProduct } from 'vtex.product-context'
import styles from "./styles.css";
export const DescontPix: FC = () => {
const productContextValue = useProduct();
2023-01-25 21:45:51 +00:00
let sellingPrice = Number(productContextValue?.product?.priceRange.sellingPrice.lowPrice);
sellingPrice = (sellingPrice - (sellingPrice/10));
2023-01-25 21:45:51 +00:00
return (
<div className={styles.containerDescontPix}>
<img src="https://agenciamagma.vteximg.com.br/arquivos/logoPixjosecarloslins.png" alt="Logo PIX" />
<div className={styles.containerDescontPixPrice}>
2023-02-06 18:57:59 +00:00
<p className={styles.priceDescontPix}>R$ {sellingPrice.toFixed(2).replace(".", ",")}</p>
<p className={styles.descontDescontPix}>10 % de desconto</p>
</div>
</div>
);
}