Adicionando prateleira de produtos na home

This commit is contained in:
Bernardo Cunha Ernani Waldhelm 2022-12-08 23:09:18 -03:00
parent 2e03035571
commit b7a5c6a975
18 changed files with 368 additions and 417 deletions

View File

@ -264,5 +264,20 @@ module.exports = {
},
],
},
{
id: "prateleira-01",
objects: [
{
type: "Produtos Relacionados",
name: "CONFIRA NOSSAS NOVIDADES", //titulo do "carousel"/prateleira
properties: {
layout: "bernardo-prateleira-padrao", // mesmo nome do arquivo em template-prateleira
type: "QuemViuViuTambem",
"number-of-columns": 12,
"number-of-items": 12,
},
},
],
},
],
};

View File

@ -20,6 +20,7 @@ import Promocao from "./partials/Promocao";
import MenuContents from "./partials/MenuContents";
import Login from "./partials/Login";
import Prateleira from "./components/Prateleira/Prateleira";
import Shelf from "./partials/Shelf";
import PrateleiraService from "./components/Prateleira/PrateleiraService";
@ -38,6 +39,7 @@ const app = new Container({
ScrollToTop,
AutoComplete,
Prateleira,
Shelf,
],
services: [PrateleiraService],
pages: [

View File

@ -96,8 +96,8 @@ export default class Prateleira {
//ex atualziar
atualizar() {
this.flagDeDesconto();
this.precoParcelado();
this.precoBoleto();
// this.precoParcelado();
// this.precoBoleto();
}
criarHtmlPrecoBoleto(valor) {
@ -123,7 +123,7 @@ export default class Prateleira {
createFlagDesconto($elemento, percentualDeDesconto) {
var $flag = $("<p />")
.addClass("flag produto-off")
.text(percentualDeDesconto + "%");
.text(percentualDeDesconto + "%OFF");
$elemento.find(".flags-product .DiscountHightLight").append($flag);
}

View File

@ -0,0 +1,16 @@
import slickConfig from "Config/slick";
export default class Shelf {
constructor() {
this.selectors();
this.createSlider();
}
selectors() {
this.shelf = $(".shelf ul");
}
createSlider() {
this.shelf.slick(slickConfig.productShelf.defaultShelf);
}
}

View File

@ -59,7 +59,7 @@ export default {
productShelf: {
defaultShelf: {
lazyLoad: "ondemand",
dots: true,
dots: false,
arrows: true,
infinite: true,
slidesToShow: 4,
@ -69,17 +69,13 @@ export default {
{
breakpoint: 1200,
settings: {
lazyLoad: "ondemand",
slidesToShow: 3,
slidesToScroll: 3,
infinite: true,
},
},
{
breakpoint: 800,
settings: {
arrows: true,
lazyLoad: "ondemand",
slidesToShow: 2,
slidesToScroll: 2,
},
@ -87,9 +83,9 @@ export default {
{
breakpoint: 576,
settings: {
arrows: false,
slidesToShow: 2,
slidesToScroll: 2,
arrows: true,
slidesToShow: 1,
slidesToScroll: 1,
},
},
],

View File

@ -98,6 +98,9 @@
background: lighten($black, 10);
}
&:active {
background: $black;
}
}
}

View File

@ -5,6 +5,21 @@
@import "./utils/all";
@import "./partials/slider";
@import "./partials/menu";
@import "./partials/header";
@import "./partials/search";
@import "./partials/barraDeVantagens";
@import "./partials/footer";
@import "./partials/breadcrumb";
@import "./partials/prateleira";
@import "./partials/ajustes";
@import "./partials/flags";
@import "./components/mini-cart";
@import "./components/newsletter";
@import "./components/instagram-gallery";
@import "./pages/home";
@import "./pages/categoria";
@import "./pages/produto";
@ -12,16 +27,3 @@
@import "./pages/erro";
@import "./pages/login";
@import "./components/mini-cart";
@import "./components/newsletter";
@import "./components/instagram-gallery";
@import "./partials/header";
@import "./partials/menu";
@import "./partials/search";
@import "./partials/barraDeVantagens";
@import "./partials/footer";
@import "./partials/breadcrumb";
@import "./partials/prateleira";
@import "./partials/ajustes";
@import "./partials/flags";

View File

@ -19,16 +19,6 @@
}
.slick-arrow {
position: absolute;
top: 50%;
transform: translateY(-50%);
z-index: map-get($z-index, level-1);
padding: 0;
border: 0;
outline: 0;
font-size: 0;
background-color: transparent;
cursor: pointer;
@extend .sprite;
@ -60,23 +50,17 @@
}
.slick-dots {
margin: 0;
position: absolute;
left: 0;
bottom: 14px;
z-index: map-get($z-index, level-1);
width: 100%;
display: flex !important;
align-items: center;
justify-content: center;
@include mq(md, max) {
bottom: 9px;
}
li {
display: flex;
margin: 0 4px;
&.slick-active {
button {
@ -88,17 +72,6 @@
}
}
}
button {
width: 10px;
height: 10px;
padding: 0;
border: 0;
outline: 0;
background: $white;
}
}
}
@ -148,4 +121,8 @@
font-size: 10px;
}
}
.shelf {
margin-bottom: 172px;
}
}

View File

@ -1,43 +1,37 @@
.flags-product {
display: block;
pointer-events: none;
position: absolute;
width: 100%;
z-index: 5;
top: 0;
left: 0;
z-index: map-get($z-index, level-2);
padding: 8px;
p {
background-repeat: no-repeat;
color: $white;
.flag {
display: none;
font-size: 11px;
float: right;
font-weight: 700;
margin: 0 0 8px;
height: 20px;
min-width: 54px;
margin: 7px 100% 0 7px;
overflow: hidden;
padding: 2.5px 4px;
text-indent: -9999px;
max-width: max-content;
font-size: 10px;
line-height: 12px;
text-transform: uppercase;
&.novo,
&.produto-off {
background: #142032;
display: table;
float: left;
text-indent: 0;
width: 50px;
&:after {
content: "OFF";
display: inline-block;
}
display: flex;
align-items: center;
justify-content: center;
}
&.novo {
background-color: #f71963;
border-radius: 5px;
display: table;
float: left;
text-indent: 0;
text-transform: uppercase;
background: $blue;
color: $white;
font-weight: bold;
}
&.produto-off{
font-weight: 900;
color: $white;
background: $black;
}
}
}

View File

@ -1,263 +1,197 @@
/***************************************************************/
/**-- Prateleiras --------------------------********************/
/*-------------------------------------------------------------*/
.prateleira-de-produtos {
position: relative;
.slick-next,
.slick-prev {
@extend .sprite;
background-color: transparent;
border: none;
cursor: pointer;
font-size: 0;
outline: none;
padding: 0;
position: absolute;
top: 30%;
z-index: 1;
@include mq(md, max) {
transform: scale(0.8);
}
}
.slick-next {
@extend .sprite;
@extend .sprite-circled-arrow-right;
left: auto;
right: -60px;
@include mq(md, max) {
right: -35px;
}
@include mq_range(md, xl) {
right: -45px;
}
}
.slick-prev {
@extend .sprite;
@extend .sprite-circled-arrow-left;
right: auto;
left: -60px;
@include mq(md, max) {
left: -35px;
}
@include mq_range(md, xl) {
left: -45px;
}
}
.slick-dots {
bottom: 20px;
height: 17px;
position: absolute;
pointer-events: none;
text-align: center;
width: 100%;
@include mq(md, max) {
margin-top: 16px;
position: initial;
}
&,
li {
align-items: center;
display: flex !important;
justify-content: center;
}
li {
display: inline-block;
margin: 0 4px;
}
button {
background-color: #142032;
border: none;
cursor: pointer;
height: 10px;
outline: none;
padding: 0;
pointer-events: all;
transition: all 0.15s ease-in-out;
width: 10px;
}
.slick-active {
button {
background-color: #f71963;
height: 16px;
width: 16px;
}
}
}
.shelf {
h2 {
color: #f71963;
font-size: 24px;
margin: 0 0 24px;
margin: 0 0 16px;
font-size: 16px;
line-height: 19px;
text-align: center;
text-transform: lowercase;
}
ul {
max-width: 95%;
margin: auto;
margin: 0;
@include mq(md, max) {
max-width: 300px;
padding: 0 32px;
}
}
.slick-track {
display: flex;
}
.slick-slide {
height: auto;
& > div,
li {
height: 100%;
}
}
li {
display: inline-block;
vertical-align: top;
padding: 0 2.5px;
.slick-arrow {
@extend .sprite;
@include mq(md, max) {
transform: translateY(-50%) scale(0.7);
}
}
}
.produto-na-prateleira {
padding: 0 5px;
position: relative;
text-align: center;
.slick-prev {
right: 100%;
.product-image {
overflow: hidden;
@include mq(md, max) {
left: 0;
right: auto;
transform-origin: left;
}
@extend .sprite-arrow-gray-prev-icon;
}
.slick-next {
left: 100%;
@include mq(md, max) {
right: 0;
left: auto;
transform-origin: right;
}
@extend .sprite-arrow-gray-next-icon;
}
.produto-na-prateleira {
display: flex;
flex-direction: column;
position: relative;
height: 100%;
margin: 0 15px;
.lazyload__sibling {
padding-bottom: 100%;
.product-image {
position: relative;
margin-bottom: 16px;
padding-top: 100%; //faz o item ficar quadrado
overflow: hidden;
+ div {
top: 0;
left: 0;
&:hover{
.foto-secundaria {
opacity: 1;
pointer-events: all;
}
}
.foto-principal,
.foto-secundaria {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: map-get($z-index , level-1);
}
}
.lazyload__sibling img {
left: 50%;
max-width: initial;
position: relative;
transform: translateX(-50%);
width: 100%;
}
.foto-principal,
.foto-secundaria {
transition: all 0.25s linear;
}
&:hover .foto-secundaria,
.foto-principal {
visibility: visible;
opacity: 1;
z-index: 1;
}
.foto-secundaria {
position: absolute;
width: 100%;
top: 0;
z-index: -1;
visibility: hidden;
opacity: 0;
}
}
.informacoes .nome {
font-size: 14px;
line-height: 16px;
margin-top: 16px;
min-height: 34px;
text-transform: capitalize;
}
.price {
margin: 8px 0 17px;
> div {
line-height: 1.3;
}
.antigo {
color: hsla(220, 1%, 43%, 1);
font-size: 14px;
min-height: 18px;
text-decoration: line-through;
}
.principal {
font-size: 18px;
font-weight: 700;
}
.parcelado {
color: hsla(220, 1%, 43%, 1);
font-size: 12px;
strong {
font-weight: normal;
}
}
.boleto {
display: none;
}
}
.compra {
.btn-compra {
margin: 0;
display: block;
transition: all 0.25s linear 0.25s;
@include mq(md, min) {
visibility: hidden;
.foto-secundaria {
opacity: 0;
pointer-events: none;
transition: all .5s ease-in-out;
}
a {
background-color: #2fab61;
color: $white;
display: block;
font-size: 14px;
letter-spacing: 1px;
padding: 15px 0;
text-transform: uppercase;
transition: all 0.15s linear;
img{
width: 100%;
height: 100%;
object-fit: cover;
}
}
@include mq(lg) {
&:hover {
background-color: hsla(138, 66%, 41%, 1);
.disponivel,
.indisponivel{
display: flex;
flex-direction: column;
justify-content: flex-end;
flex: 1;
}
.nome {
text-transform: uppercase;
text-align: center;
line-height: 12px;
font-size: 10px;
font-weight: 500;
margin-bottom: 17px;
}
.price {
margin-bottom: 17px;
text-align: center;
text-transform: uppercase;
.antigo {
margin-bottom: 4px;
text-decoration: line-through;
font-size: 10px;
line-height: 12px;
color: $gray-300;
}
.principal {
margin-bottom: 4px;
font-weight: 900;
font-size: 13px;
line-height: 16px;
}
.parcelado {
color: $gray-500;
font-size: 10px;
line-height: 12px;
}
}
.btn-compra {
a {
display: flex;
align-items: center;
justify-content: center;
height: 50px;
background: $black;
color: $white;
font-weight: bold;
font-size: 10px;
line-height: 12px;
@include mq(lg, max) {
&:active {
background: lighten($black, 10);
}
}
@include mq(lg, min) {
&:hover{
background: lighten($black, 10);
}
&:active {
background-color: hsla(138, 50%, 41%, 1);
background: $black;
}
}
}
}
}
@include mq(lg) {
&:hover .compra .btn-compra {
visibility: visible;
opacity: 1;
z-index: 1;
.indisponivel {
.erro {
display: flex;
align-items: center;
justify-content: center;
height: 50px;
color: $red-300;
font-weight: bold;
font-size: 10px;
line-height: 12px;
}
}
}
.indisponivel {
color: #f71963;
font-weight: bold;
margin: 5px 0;
}
}

View File

@ -0,0 +1,36 @@
.slick-arrow {
position: absolute;
top: 50%;
transform: translateY(-50%);
z-index: map-get($z-index , level-1);
font-size: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 0;
background-color: transparent;
cursor: pointer;
}
.slick-dots {
display: flex !important;
align-items: center;
justify-content: center;
margin: 0;
li {
display: flex;
margin: 0 4px;
}
button {
width: 10px;
height: 10px;
padding: 0;
border: 0;
outline: 0;
background: $white;
}
}

View File

@ -1,5 +1,5 @@
// fonts
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700;900&family=Poppins:wght@700&family=Roboto&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700;900&family=Poppins:wght@700&family=Roboto&display=swap');
$font-family: "Inter", sans-serif;
$font-height: 1.5;
@ -18,6 +18,7 @@ $gray-100: #e0e0e0;
$gray-200: #828282;
$gray-300: #6D6E70;
$gray-400: #bdbdbd;
$gray-500: #6D6E70;
// Grid breakpoints

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -56,6 +56,12 @@
</li>
</ul>
</section>
<section class="shelf">
<div class="container">
<vtex:contentPlaceHolder id="prateleira-01" />
</div>
</section>
</main>
<footer>

View File

@ -16,7 +16,7 @@
<!-- $product.DiscountHightLight -->
</span>
</div>
<div class="product-image ">
<div class="product-image">
<a href="produto.html" title="Titulo do produto">
<!-- title=$product.EscapedName -->
<div class="foto-principal">
@ -42,7 +42,7 @@
<div class="informacoes">
<div class="avaliacao"></div>
<div class="nome">
Titulo do produto
Lorem Ipsum Dolor
<!-- $product.EscapedName -->
</div>
</div>
@ -52,47 +52,37 @@
<div class="antigo">
<!-- #if ($product.HasBestPrice) -->
<span class="value">
R$ 1500000,00
R$ 4.350,50
<!-- $product.ListPrice -->
</span>
<!-- #end -->
</div>
<div class="principal">
<span class="value">
R$ 1000000,00
R$ 3.799,05
<!-- $product.BestPrice -->
</span>
</div>
<div class="parcelado">
<span class="desconto-parcelado">
ou
<strong>
<span class="numero-de-parcelas">1</span>X de
<span class="value">
R$ 2,50
<!-- $product.BestPrice -->
</span>
</strong>
no cartão
<span class="numero-de-parcelas">10</span>X de
<span class="value">
R$ 399,90
<!-- $product.BestPrice -->
</span>
sem juros
</span>
</div>
<div class="boleto">
<span class="value">
R$ 9,50
<!-- $product.BestPrice -->
</span>
à vista no boleto bancário
</div>
</div>
<div class="compra">
<span class="btn-compra">
<a title="Compre agora" href="produto.html">Compre agora</a>
<a title="Compre agora" href="produto.html">COMPRE AGORA</a>
</span>
</div>
</div>
<!-- #else -->
<div class="indisponivel">
<span class="erro">Produto indisponível</span>
</div>
<!-- <div class="indisponivel">
<span class="erro">INDISPONÍVEL</span>
</div> -->
<!-- #end -->
</div>

View File

@ -0,0 +1,63 @@
#set($id = $product.Id) #set($idSku = $product.productVariantId) #set($uri =
$product.Uri) #set($escapedName = $product.HtmlEscapedName)
<div class="produto-na-prateleira" data-sku-id="$id">
<div class="flags-product">
<span class="HightLight"> $product.HightLight </span>
<span class="DiscountHightLight"> $product.DiscountHightLight </span>
</div>
<div class="product-image">
<a href="$uri" title="$escapedName">
<div class="foto-principal">
<div class="lazyload__sibling"></div>
<div class="lazyload" data-noscript="">
<noscript> $product.GetImageTag(2) </noscript>
</div>
</div>
<div class="foto-secundaria">
<div class="lazyload__sibling"></div>
<div class="lazyload" data-noscript="">
<noscript> $product.GetImageTag(2,"ultima") </noscript>
</div>
</div>
</a>
</div>
<div class="informacoes">
<div class="avaliacao"></div>
<div class="nome">$escapedName</div>
</div>
#if ($product.IsInStock)
<div class="disponivel">
<div class="price">
<div class="antigo">
#if ($product.HasBestPrice)
<span class="value"> $product.ListPrice </span>
#end
</div>
<div class="principal">
<span class="value"> $product.BestPrice </span>
</div>
#if($product.NumbersOfInstallment > 1)
<div class="parcelado">
<span class="desconto-parcelado">
<span class="numero-de-parcelas"
>$product.NumbersOfInstallment</span
>X de
<span class="value"> $product.InstallmentValue </span>
sem juros
</span>
</div>
#end
</div>
<div class="compra">
<span class="btn-compra">
<a title="Compre agora" href="$uri">COMPRE AGORA</a>
</span>
</div>
</div>
#else
<div class="indisponivel">
<span class="erro">INDISPONÍVEL</span>
</div>
#end
</div>

View File

@ -1,84 +0,0 @@
#set($id = $product.Id)
#set($idSku = $product.productVariantId)
#set($uri = $product.Uri)
#set($escapedName = $product.HtmlEscapedName)
<div class="produto-na-prateleira" data-sku-id="$id">
<div class="flags-product">
<span class="HightLight">
$product.HightLight
</span>
<span class="DiscountHightLight">
$product.DiscountHightLight
</span>
</div>
<div class="product-image ">
<a href="$uri" title=$escapedName>
<div class="foto-principal" >
<div class="lazyload__sibling"></div>
<div class="lazyload" data-noscript="">
<noscript>
$product.GetImageTag(2)
</noscript>
</div>
</div>
<div class="foto-secundaria" >
<div class="lazyload__sibling"></div>
<div class="lazyload" data-noscript="">
<noscript>
$product.GetImageTag(2,"ultima")
</noscript>
</div>
</div>
</a>
</div>
<div class="informacoes">
<div class="avaliacao"></div>
<div class="nome">
$escapedName
</div>
</div>
#if ($product.IsInStock)
<div class="disponivel">
<div class="price">
<div class="antigo">
#if ($product.HasBestPrice)
<span class="value">
$product.ListPrice
</span>
#end
</div>
<div class="principal">
<span class="value">
$product.BestPrice
</span>
</div>
#if($product.NumbersOfInstallment > 1)
<div class="parcelado">
<span class="desconto-parcelado">
ou
<strong>
<span class="numero-de-parcelas">$product.NumbersOfInstallment</span>X de
<span class="value">
$product.InstallmentValue
</span>
</strong>
no cartão
</span>
</div>
#end
</div>
<div class="compra">
<span class="btn-compra">
<a title="Compre agora" href="$uri">Compre agora</a>
</span>
</div>
</div>
#else
<div class="indisponivel">
<span class="erro">Produto indisponível</span>
</div>
#end
</div>