feature/template-checkout #1

Merged
FilipeQuintanilha merged 12 commits from feature/template-checkout into main 2022-12-19 02:42:46 +00:00
2 changed files with 269 additions and 65 deletions
Showing only changes of commit 343b799e01 - Show all commits

View File

@ -9,6 +9,7 @@ export default class Header {
async init() {
await this.selectors();
this.progressBarHTML();
await this.progressBarProgress();
// console.log(this.item);
}
@ -59,5 +60,203 @@ export default class Header {
</ul>
`;
}
if (this.progressBar && window.innerWidth <= 1024) {
this.progressBar.innerHTML = ``;
}
}
progressBarProgress() {
if (this.progressBar && window.innerWidth > 1024) {
const progressBarLista = document.querySelectorAll("#progressBar ul li");
progressBarLista.forEach((li) => {
if (window.location.href === "https://m3academy.myvtex.com/checkout/#/cart") {
if (li.children[0].children[0].children["progressbar-circle-1"]) {
li.children[0].children[0].children["progressbar-circle-1"].classList.add(
"active"
);
}
if (li.children[0].children[0].children["progressbar-circle-2"]) {
if (
li.children[0].children[0].children[
"progressbar-circle-2"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progressbar-circle-2"
].classList.remove("active");
}
}
if (li.children[0].children[0].children["progressbar-circle-3"]) {
if (
li.children[0].children[0].children[
"progressbar-circle-3"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progressbar-circle-3"
].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["progressbar-circle-1"]) {
if (
li.children[0].children[0].children[
"progressbar-circle-1"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progressbar-circle-1"
].classList.remove("active");
}
}
if (li.children[0].children[0].children["progressbar-circle-2"]) {
li.children[0].children[0].children["progressbar-circle-2"].classList.add(
"active"
);
}
if (li.children[0].children[0].children["progressbar-circle-3"]) {
if (
li.children[0].children[0].children[
"progressbar-circle-3"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progressbar-circle-3"
].classList.remove("active");
}
}
} else if (
window.location.href === "https://m3academy.myvtex.com/checkout/#/payment"
) {
if (li.children[0].children[0].children["progressbar-circle-1"]) {
if (
li.children[0].children[0].children[
"progressbar-circle-1"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progressbar-circle-1"
].classList.remove("active");
}
}
if (li.children[0].children[0].children["progressbar-circle-2"]) {
if (
li.children[0].children[0].children[
"progressbar-circle-2"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progressbar-circle-2"
].classList.remove("active");
}
}
if (li.children[0].children[0].children["progressbar-circle-3"]) {
li.children[0].children[0].children["progressbar-circle-3"].classList.add(
"active"
);
}
}
window.addEventListener("hashchange", () => {
if (window.location.hash == "#/cart") {
if (li.children[0].children[0].children["progressbar-circle-1"]) {
li.children[0].children[0].children[
"progressbar-circle-1"
].classList.add("active");
}
if (li.children[0].children[0].children["progressbar-circle-2"]) {
if (
li.children[0].children[0].children[
"progressbar-circle-2"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progressbar-circle-2"
].classList.remove("active");
}
}
if (li.children[0].children[0].children["progressbar-circle-3"]) {
if (
li.children[0].children[0].children[
"progressbar-circle-3"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progressbar-circle-3"
].classList.remove("active");
}
}
} else if (
window.location.hash === "#/email" ||
window.location.hash === "#/profile" ||
window.location.hash === "#/shipping"
) {
if (li.children[0].children[0].children["progressbar-circle-1"]) {
if (
li.children[0].children[0].children[
"progressbar-circle-1"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progressbar-circle-1"
].classList.remove("active");
}
}
if (li.children[0].children[0].children["progressbar-circle-2"]) {
li.children[0].children[0].children[
"progressbar-circle-2"
].classList.add("active");
}
if (li.children[0].children[0].children["progressbar-circle-3"]) {
if (
li.children[0].children[0].children[
"progressbar-circle-3"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progressbar-circle-3"
].classList.remove("active");
}
}
} else if (window.location.hash === "#/payment") {
if (li.children[0].children[0].children["progressbar-circle-1"]) {
if (
li.children[0].children[0].children[
"progressbar-circle-1"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progressbar-circle-1"
].classList.remove("active");
}
}
if (li.children[0].children[0].children["progressbar-circle-2"]) {
if (
li.children[0].children[0].children[
"progressbar-circle-2"
].classList.contains("active")
) {
li.children[0].children[0].children[
"progressbar-circle-2"
].classList.remove("active");
}
}
if (li.children[0].children[0].children["progressbar-circle-3"]) {
li.children[0].children[0].children[
"progressbar-circle-3"
].classList.add("active");
}
}
});
});
}
}
}

View File

@ -1,7 +1,7 @@
/* _header.scss */
.headerCheckout {
width: 100%;
border-bottom: 1px solid black;
border-bottom: 2px solid gray;
.container {
width: 79.53125% !important;
@ -10,8 +10,8 @@
list-style-type: none;
display: flex;
margin: 0;
gap: 100px;
}
gap: 107px;
li {
.containerLi {
width: 100%;
@ -29,11 +29,10 @@
}
.progressbar-circle-1 {
width: 12%;
width: 13%;
left: 41%;
height: 10px;
position: relative;
background-color: black;
border: 1px solid black;
border-radius: 50%;
margin: 0;
@ -44,13 +43,13 @@
left: 10%;
transform: translate(20%);
bottom: -2px;
width: 224%;
width: 227%;
height: 1px;
border-top: 1px solid #000;
}
.progressbar-circle-2 {
width: 10%;
width: 11%;
left: 41%;
height: 10px;
position: relative;
@ -61,7 +60,7 @@
}
.progressbar-circle-3 {
width: 14%;
width: 16%;
left: 41%;
height: 10px;
position: relative;
@ -73,13 +72,18 @@
.progress-bar-line-2 {
position: absolute;
right: 30%;
transform: translate(-11%);
right: 31%;
transform: translate(-10%);
bottom: -2px;
width: 269%;
width: 279%;
height: 1px;
border-top: 1px solid #000;
}
.active {
background-color: #000;
}
}
}
}
}
@ -92,9 +96,10 @@
}
&__logo {
width: 15.3%;
img {
height: 37px;
width: auto;
width: 100%;
}
}