feat(product): adicionando novas parcelas ao produto

This commit is contained in:
Bernardo Cunha Ernani Waldhelm 2023-01-25 10:43:53 -03:00
parent b9e9bfe8b3
commit 86add06fbb
10 changed files with 69 additions and 12 deletions

2
react/Installment.tsx Normal file
View File

@ -0,0 +1,2 @@
import Installment from "./components/Installment/index";
export default Installment;

View File

@ -0,0 +1,15 @@
.installment-product {
font-family: 'Open Sans', sans-serif;
font-style: normal;
font-weight: 400;
font-size: 16px;
line-height: 22px;
margin: 0;
padding: 0;
height: 22px;
color: #929292;
}
.installment-product__strong {
font-weight: 700;
}

View File

@ -0,0 +1,33 @@
import React from "react";
import { useProduct } from "vtex.product-context";
import styles from "./Installment.module.css";
const Installment = () => {
const skuProduct = useProduct();
console.log(skuProduct);
const productInstallment = {
numberOfInstallment:
skuProduct?.selectedItem?.sellers[0].commertialOffer.Installments[3]
.NumberOfInstallments,
value:
skuProduct?.selectedItem?.sellers[0].commertialOffer.Installments[3]
.Value,
};
return (
<p className={styles["installment-product"]}>
<span className={styles["installment-product__strong"]}>
{productInstallment.numberOfInstallment}x{" "}
</span>
de
<span className={styles["installment-product__strong"]}>
{""} R${" "}
{productInstallment.value?.toFixed(2).toString().replace(".", ",")}{" "}
</span>
sem juros
</p>
);
};
export default Installment;

1
react/index.d.ts vendored Normal file
View File

@ -0,0 +1 @@
declare module "*.module.css";

View File

@ -112,7 +112,7 @@
// "product-rating-summary", // "product-rating-summary",
// "flex-layout.row#list-price-savings", preço com promoção vindo vtex // "flex-layout.row#list-price-savings", preço com promoção vindo vtex
"flex-layout.row#selling-price", "flex-layout.row#selling-price",
"product-installments", "installment-component",
"product-separator", "product-separator",
"sku-selector", "sku-selector",
"product-quantity", "product-quantity",
@ -127,7 +127,6 @@
"flex-layout.row#product-name": { "flex-layout.row#product-name": {
"props": { "props": {
"marginBottom": 3,
"blockClass": "product__name" "blockClass": "product__name"
}, },
"children": ["vtex.store-components:product-name"] "children": ["vtex.store-components:product-name"]
@ -136,7 +135,9 @@
"sku-selector": { "sku-selector": {
"props": { "props": {
"variationsSpacing": 3, "variationsSpacing": 3,
"showValueNameForImageVariation": true "showValueNameForImageVariation": true,
"blockClass": "sku-product"
} }
}, },

View File

@ -5,5 +5,9 @@
"html": { "html": {
"component": "html", "component": "html",
"composition": "children" "composition": "children"
},
"installment-component": {
"component": "Installment"
} }
} }

View File

@ -105,12 +105,15 @@
padding-bottom: 1rem; padding-bottom: 1rem;
} }
.flexRowContent--product__image {
padding: 0;
margin: 0;
}
@media (min-width: 491px) and (max-width: 1024px), (min-width: 280px) and (max-width: 490px) { @media (min-width: 491px) and (max-width: 1024px), (min-width: 280px) and (max-width: 490px) {
.flexRowContent--product__image { .flexRowContent--product__image {
flex-direction: column; flex-direction: column;
} }
} }
.flexRowContent--product__image .stretchChildrenWidth:first-child { .flexRowContent--product__image .stretchChildrenWidth:first-child {
padding-right: 16px; padding-right: 16px;
margin-right: 16px; margin-right: 16px;

View File

@ -8,9 +8,8 @@
/* Media Query M3 */ /* Media Query M3 */
@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;700&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;700&display=swap");
/* Grid breakpoints */ /* Grid breakpoints */
.sellingPriceValue { .sellingPrice {
font-family: "Open Sans", sans-serif; font-family: "Open Sans", sans-serif;
font-style: normal;
font-weight: 700; font-weight: 700;
font-size: 25px; font-size: 25px;
line-height: 38px; line-height: 38px;

View File

@ -98,12 +98,12 @@
} }
.flexRowContent--product__image { .flexRowContent--product__image {
padding: 0;
margin: 0;
@media #{$mq-tablet}, #{$mq-mobile} { @media #{$mq-tablet}, #{$mq-mobile} {
flex-direction: column; flex-direction: column;
} }
}
.flexRowContent--product__image {
.stretchChildrenWidth { .stretchChildrenWidth {
&:first-child { &:first-child {

View File

@ -1,6 +1,5 @@
.sellingPriceValue{ .sellingPrice {
font-family: $font-family; font-family: $font-family;
font-style: normal;
font-weight: 700; font-weight: 700;
font-size: 25px; font-size: 25px;
line-height: 38px; line-height: 38px;