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,75 +10,79 @@
list-style-type: none;
display: flex;
margin: 0;
gap: 100px;
}
li {
.containerLi {
width: 100%;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
position: relative;
gap: 107px;
.progress-bar-text {
margin-bottom: 9px;
font-family: $font-family-secundary;
font-size: 12px;
line-height: 14px;
}
.progressbar-circle-1 {
width: 12%;
left: 41%;
height: 10px;
li {
.containerLi {
width: 100%;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
position: relative;
background-color: black;
border: 1px solid black;
border-radius: 50%;
margin: 0;
}
.progress-bar-line-1 {
position: absolute;
left: 10%;
transform: translate(20%);
bottom: -2px;
width: 224%;
height: 1px;
border-top: 1px solid #000;
}
.progress-bar-text {
margin-bottom: 9px;
font-family: $font-family-secundary;
font-size: 12px;
line-height: 14px;
}
.progressbar-circle-2 {
width: 10%;
left: 41%;
height: 10px;
position: relative;
background-color: white;
border: 1px solid black;
border-radius: 50%;
margin: 0;
}
.progressbar-circle-1 {
width: 13%;
left: 41%;
height: 10px;
position: relative;
border: 1px solid black;
border-radius: 50%;
margin: 0;
}
.progressbar-circle-3 {
width: 14%;
left: 41%;
height: 10px;
position: relative;
background-color: white;
border: 1px solid black;
border-radius: 50%;
margin: 0;
}
.progress-bar-line-1 {
position: absolute;
left: 10%;
transform: translate(20%);
bottom: -2px;
width: 227%;
height: 1px;
border-top: 1px solid #000;
}
.progress-bar-line-2 {
position: absolute;
right: 30%;
transform: translate(-11%);
bottom: -2px;
width: 269%;
height: 1px;
border-top: 1px solid #000;
.progressbar-circle-2 {
width: 11%;
left: 41%;
height: 10px;
position: relative;
background-color: white;
border: 1px solid black;
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 {
width: 15.3%;
img {
height: 37px;
width: auto;
width: 100%;
}
}