develop #5

Merged
RamonDiasFerreira merged 17 commits from develop into main 2022-12-19 00:11:34 +00:00
3 changed files with 349 additions and 10893 deletions
Showing only changes of commit 2f60db6351 - Show all commits

10970
checkout/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -8,14 +8,166 @@ export default class Header {
async init() { async init() {
await this.selectors(); await this.selectors();
console.log(this.item); this.progressBarHTML();
await this.barProgress();
} }
async selectors() { async selectors() {
this.item = await waitElement("#my-element", { this.progressBar = await waitElement("#progressBar", {
//#my-element pode ser a class ou o id do elemento html qeu vocÊ quer pegar timeout: 5000,
timeout: 5000, // vai esperar 5 segundos antes de rejeitar a promise interval: 1000,
interval: 1000, // vai verificar a cada 1 segundo se o elemento existe
}); });
} }
progressBarHTML() {
if (this.progressBar && window.innerWidth > 1024) {
this.progressBar.innerHTML = `
<ul>
<li>
<div class="containerLi">
<p class="progress-bar-text">Meu Carrinho</p>
<div style="margin-left: 29px;">
<p id="progress-bar-circle-1" class="progress-bar-circle"></p>
<p class="progress-bar-line-1"></p>
</div>
</div>
</li>
<li class="central">
<div class="containerLi">
<p class="progress-bar-text">Dados Pessoais</p>
<p id="progress-bar-circle-2" class="progress-bar-circle"></p>
</div>
</li>
<li>
<div class="containerLi">
<p class="progress-bar-text">Pagamento</p>
<div style="margin-right: 22px;">
<p id="progress-bar-circle-3" class="progress-bar-circle"></p>
</div>
<p class="progress-bar-line-2"></p>
</div>
</li>
</ul>
`;
}
if (this.progressBar && window.innerWidth <= 1024) {
this.progressBar.innerHTML = ``;
}
}
async barProgress() {
if (this.progressBar && window.innerWidth > 1024) {
const progressBarLista = document.querySelectorAll("#progressBar ul li");
progressBarLista.forEach((li) => {
console.log(li.children[0]);
const circleOne = li.children[0].children[1].children["progress-bar-circle-1"];
const circleTwo = li.children[0].children["progress-bar-circle-2"];
const circleThree = li.children[0].children[1].children["progress-bar-circle-3"];
if (window.location.href === "https://m3academy.myvtex.com/checkout/#/cart") {
if (circleOne) {
circleOne.classList.add("active");
}
if (circleTwo) {
if (circleTwo.classList.contains("active")) {
circleTwo.classList.remove("active");
}
}
if (circleThree) {
if (circleThree.classList.contains("active")) {
circleThree.classList.remove("active");
}
}
} else if (
window.location.href === "https://m3academy.myvtex.com/checkout/#/email" ||
window.location.href === "https://m3academy.myvtex.com/checkout/#/profile" ||
window.location.href == "https://m3academy.myvtex.com/checkout/#/shipping"
) {
if (circleOne) {
if (circleOne.classList.contains("active")) {
circleOne.classList.remove("active");
}
}
if (circleTwo) {
circleTwo.classList.add("active");
}
if (circleThree) {
if (circleThree.classList.contains("active")) {
circleThree.classList.remove("active");
}
}
} else if (
window.location.href === "https://m3academy.myvtex.com/checkout/#/payment"
) {
if (circleOne) {
if (circleOne.classList.contains("active")) {
circleOne.classList.remove("active");
}
}
if (circleTwo) {
if (circleTwo.classList.contains("active")) {
circleTwo.classList.remove("active");
}
}
if (circleThree) {
circleThree.classList.add("active");
}
}
window.addEventListener("hashchange", () => {
if (window.location.hash == "#/cart") {
if (circleOne) {
circleOne.classList.add("active");
}
if (circleTwo) {
if (circleTwo.classList.contains("active")) {
circleTwo.classList.remove("active");
}
}
if (circleThree) {
if (circleThree.classList.contains("active")) {
circleThree.classList.remove("active");
}
}
} else if (
window.location.hash === "#/email" ||
window.location.hash === "#/profile" ||
window.location.hash === "#/shipping"
) {
if (circleOne) {
if (circleOne.classList.contains("active")) {
circleOne.classList.remove("active");
}
}
if (circleTwo) {
circleTwo.classList.add("active");
}
if (circleThree) {
if (circleThree.classList.contains("active")) {
circleThree.classList.remove("active");
}
}
} else if (window.location.hash == "#/payment") {
if (circleOne) {
if (circleOne.classList.contains("active")) {
circleOne.classList.remove("active");
}
}
if (circleTwo) {
if (circleTwo.classList.contains("active")) {
circleTwo.classList.remove("active");
}
}
if (circleThree) {
circleThree.classList.add("active");
}
}
});
});
}
}
} }

View File

@ -2,7 +2,108 @@
.headerCheckout { .headerCheckout {
.container { .container {
width: auto !important; width: auto !important;
#progressBar {
width: 439px;
ul {
list-style-type: none;
display: flex;
align-items: center;
justify-content: space-between;
margin: 0;
} }
li .containerLi {
width: 100%;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
position: relative;
}
li.central .containerLi {
align-items: center;
margin-left: 7px;
}
li:last-child .containerLi {
align-items: flex-end;
}
li .container div {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
li {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-family: "Tenor Sans";
font-size: 12px;
font-weight: 400;
line-height: 28px;
color: #000000;
width: 39.9103%;
@media (min-width: 2500px) {
font-size: 24px;
}
}
li.central {
width: auto;
}
li #progress-bar-circle-1,
li #progress-bar-circle-2,
li #progress-bar-circle-3 {
width: 12px;
height: 12px;
border: 1px solid #000000;
border-radius: 50%;
@media (min-width: 2500px) {
width: 24px;
height: 24px;
}
}
li #progress-bar-circle-1.active,
li #progress-bar-circle-2.active,
li #progress-bar-circle-3.active {
border: none;
background-color: #000000;
}
li .progress-bar-line-1 {
position: absolute;
width: 100%;
left: 25%;
transform: translateY(-50%);
bottom: 5px;
height: 1px;
border-top: 1px solid #000000;
}
li .progress-bar-line-2 {
position: absolute;
width: 100%;
right: 21%;
transform: translateY(-50%);
bottom: 5px;
height: 1px;
border-top: 1px solid #000000;
}
}
.active {
background: #000000;
}
}
&__wrapper { &__wrapper {
align-items: center; align-items: center;
display: flex; display: flex;
@ -19,17 +120,18 @@
&__safeBuy { &__safeBuy {
span { span {
align-items: center; align-items: center;
display: flex;
text-transform: uppercase; text-transform: uppercase;
font-family: $font-family; font-family: $font-family;
line-height: 15px;
color: $color-gray;
font-style: normal; font-style: normal;
font-weight: normal; font-weight: normal;
font-size: 12px; font-size: 12px;
line-height: 14px;
color: $color-gray;
} }
i { img {
width: 12px;
margin-right: 8px; margin-right: 8px;
} }
} }