develop #14

Merged
ManuelaLuanaSchumackerTavares merged 26 commits from develop into main 2022-12-18 21:45:24 +00:00
2 changed files with 215 additions and 1 deletions
Showing only changes of commit eab225d529 - Show all commits

View File

@ -9,6 +9,7 @@ export default class Header {
async init() {
await this.selectors();
this.progressBarContent();
await this.progressBarDot();
}
async selectors() {
@ -55,4 +56,202 @@ export default class Header {
this.progressBar.innerHTML = ``;
}
}
async progressBarDot() {
if (this.progressBar && window.innerWidth > 1024) {
const progressList = document.querySelectorAll("#progressBar ul li");
progressList.forEach((li) => {
if (window.location.href === "https://m3academy.myvtex.com/checkout/#/cart") {
if (li.children[0].children[0].children["progress-bar-first-circle"]) {
li.children[0].children[0].children[
"progress-bar-first-circle"
].classList.add("active");
}
if (li.children[0].children[0].children["progress-bar-second-circle"]) {
if (
li.children[0].children[0].children[
"progress-bar-second-circle"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progress-bar-second-circle"
].classList.remove("active");
}
}
if (li.children[0].children[0].children["progress-bar-third-circle"]) {
if (
li.children[0].children[0].children[
"progress-bar-third-circle"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progress-bar-third-circle"
].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 (li.children[0].children[0].children["progress-bar-first-circle"]) {
if (
li.children[0].children[0].children[
"progress-bar-first-circle"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progress-bar-first-circle"
].classList.remove("active");
}
}
if (li.children[0].children[0].children["progress-bar-second-circle"]) {
li.children[0].children[0].children[
"progress-bar-second-circle"
].classList.add("active");
}
if (li.children[0].children[0].children["progress-bar-third-circle"]) {
if (
li.children[0].children[0].children[
"progress-bar-third-circle"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progress-bar-third-circle"
].classList.remove("active");
}
}
} else if (
window.location.href === "https://m3academy.myvtex.com/checkout/#/payment"
) {
if (li.children[0].children[0].children["progress-bar-first-circle"]) {
if (
li.children[0].children[0].children[
"progress-bar-first-circle"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progress-bar-first-circle"
].classList.remove("active");
}
}
if (li.children[0].children[0].children["progress-bar-second-circle"]) {
if (
li.children[0].children[0].children[
"progress-bar-second-circle"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progress-bar-second-circle"
].classList.remove("active");
}
}
if (li.children[0].children[0].children["progress-bar-third-circle"]) {
li.children[0].children[0].children[
"progress-bar-third-circle"
].classList.add("active");
}
}
this.progressBarWhenHashChange();
});
}
}
progressBarWhenHashChange() {
const progressList = document.querySelectorAll("#progressBar ul li");
progressList.forEach((li) => {
window.addEventListener("hashchange", () => {
if (window.location.hash == "#/cart") {
if (li.children[0].children[0].children["progress-bar-first-circle"]) {
li.children[0].children[0].children[
"progress-bar-first-circle"
].classList.add("active");
}
if (li.children[0].children[0].children["progress-bar-second-circle"]) {
if (
li.children[0].children[0].children[
"progress-bar-second-circle"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progress-bar-second-circle"
].classList.remove("active");
}
}
if (li.children[0].children[0].children["progress-bar-third-circle"]) {
if (
li.children[0].children[0].children[
"progress-bar-third-circle"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progress-bar-third-circle"
].classList.remove("active");
}
}
} else if (
window.location.hash == "#/email" ||
window.location.hash == "#/profile" ||
window.location.hash == "#/shipping"
) {
if (li.children[0].children[0].children["progress-bar-first-circle"]) {
if (
li.children[0].children[0].children[
"progress-bar-first-circle"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progress-bar-first-circle"
].classList.remove("active");
}
}
if (li.children[0].children[0].children["progress-bar-second-circle"]) {
li.children[0].children[0].children[
"progress-bar-second-circle"
].classList.add("active");
}
if (li.children[0].children[0].children["progress-bar-third-circle"]) {
if (
li.children[0].children[0].children[
"progress-bar-third-circle"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progress-bar-third-circle"
].classList.remove("active");
}
}
} else if (window.location.hash == "#/payment") {
if (li.children[0].children[0].children["progress-bar-first-circle"]) {
if (
li.children[0].children[0].children[
"progress-bar-first-circle"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progress-bar-first-circle"
].classList.remove("active");
}
}
if (li.children[0].children[0].children["progress-bar-second-circle"]) {
if (
li.children[0].children[0].children[
"progress-bar-second-circle"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progress-bar-second-circle"
].classList.remove("active");
}
}
if (li.children[0].children[0].children["progress-bar-third-circle"]) {
li.children[0].children[0].children[
"progress-bar-third-circle"
].classList.add("active");
}
}
});
});
}
}

View File

@ -94,7 +94,6 @@
margin-top: 9px;
border: 1px solid $color-black2;
border-radius: 50%;
background: $color-white;
@include mq(xxl, min) {
width: 24px;
@ -102,6 +101,18 @@
}
}
.containerProgressBar .progress-bar-first-circle {
background: $color-white;
}
.containerProgressBar .progress-bar-second-circle {
background: $color-white;
}
.containerProgressBar .progress-bar-third-circle {
background: $color-white;
}
&__logo {
img {
height: 52px;
@ -165,4 +176,8 @@
}
}
}
.active {
background: $color-black2 !important;
}
}