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() { async init() {
await this.selectors(); await this.selectors();
this.progressBarHTML(); this.progressBarHTML();
await this.progressBarProgress();
// console.log(this.item); // console.log(this.item);
} }
@ -59,5 +60,203 @@ export default class Header {
</ul> </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 */ /* _header.scss */
.headerCheckout { .headerCheckout {
width: 100%; width: 100%;
border-bottom: 1px solid black; border-bottom: 2px solid gray;
.container { .container {
width: 79.53125% !important; width: 79.53125% !important;
@ -10,75 +10,79 @@
list-style-type: none; list-style-type: none;
display: flex; display: flex;
margin: 0; margin: 0;
gap: 100px; gap: 107px;
}
li {
.containerLi {
width: 100%;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
position: relative;
.progress-bar-text { li {
margin-bottom: 9px; .containerLi {
font-family: $font-family-secundary; width: 100%;
font-size: 12px; display: flex;
line-height: 14px; flex-direction: column;
} align-items: flex-start;
justify-content: center;
.progressbar-circle-1 {
width: 12%;
left: 41%;
height: 10px;
position: relative; position: relative;
background-color: black;
border: 1px solid black;
border-radius: 50%;
margin: 0;
}
.progress-bar-line-1 { .progress-bar-text {
position: absolute; margin-bottom: 9px;
left: 10%; font-family: $font-family-secundary;
transform: translate(20%); font-size: 12px;
bottom: -2px; line-height: 14px;
width: 224%; }
height: 1px;
border-top: 1px solid #000;
}
.progressbar-circle-2 { .progressbar-circle-1 {
width: 10%; width: 13%;
left: 41%; left: 41%;
height: 10px; height: 10px;
position: relative; position: relative;
background-color: white; border: 1px solid black;
border: 1px solid black; border-radius: 50%;
border-radius: 50%; margin: 0;
margin: 0; }
}
.progressbar-circle-3 { .progress-bar-line-1 {
width: 14%; position: absolute;
left: 41%; left: 10%;
height: 10px; transform: translate(20%);
position: relative; bottom: -2px;
background-color: white; width: 227%;
border: 1px solid black; height: 1px;
border-radius: 50%; border-top: 1px solid #000;
margin: 0; }
}
.progress-bar-line-2 { .progressbar-circle-2 {
position: absolute; width: 11%;
right: 30%; left: 41%;
transform: translate(-11%); height: 10px;
bottom: -2px; position: relative;
width: 269%; background-color: white;
height: 1px; border: 1px solid black;
border-top: 1px solid #000; border-radius: 50%;
margin: 0;
}
.progressbar-circle-3 {
width: 16%;
left: 41%;
height: 10px;
position: relative;
background-color: white;
border: 1px solid black;
border-radius: 50%;
margin: 0;
}
.progress-bar-line-2 {
position: absolute;
right: 31%;
transform: translate(-10%);
bottom: -2px;
width: 279%;
height: 1px;
border-top: 1px solid #000;
}
.active {
background-color: #000;
}
} }
} }
} }
@ -92,9 +96,10 @@
} }
&__logo { &__logo {
width: 15.3%;
img { img {
height: 37px; height: 37px;
width: auto; width: 100%;
} }
} }