style(Header): remoção de selectors não utilizado, organização do codigo.

This commit is contained in:
Ramon Dias Ferreira 2022-12-18 15:44:00 -03:00
parent 3077f8df10
commit e69aedc6af

View File

@ -63,7 +63,7 @@ export default class Header {
if (this.progressBar && window.innerWidth > 1024) { if (this.progressBar && window.innerWidth > 1024) {
const progressBarLista = document.querySelectorAll("#progressBar ul li"); const progressBarLista = document.querySelectorAll("#progressBar ul li");
progressBarLista.forEach((li) => { progressBarLista.forEach((li) => {
console.log(li.children[0]) console.log(li.children[0]);
const circleOne = li.children[0].children[1].children["progress-bar-circle-1"]; const circleOne = li.children[0].children[1].children["progress-bar-circle-1"];
const circleTwo = li.children[0].children["progress-bar-circle-2"]; const circleTwo = li.children[0].children["progress-bar-circle-2"];
const circleThree = li.children[0].children[1].children["progress-bar-circle-3"]; const circleThree = li.children[0].children[1].children["progress-bar-circle-3"];
@ -72,7 +72,6 @@ export default class Header {
if (circleOne) { if (circleOne) {
circleOne.classList.add("active"); circleOne.classList.add("active");
} }
if (circleTwo) { if (circleTwo) {
if (circleTwo.classList.contains("active")) { if (circleTwo.classList.contains("active")) {
circleTwo.classList.remove("active"); circleTwo.classList.remove("active");
@ -109,24 +108,20 @@ export default class Header {
circleOne.classList.remove("active"); circleOne.classList.remove("active");
} }
} }
if (circleTwo) { if (circleTwo) {
if (circleTwo.classList.contains("active")) { if (circleTwo.classList.contains("active")) {
circleTwo.classList.remove("active"); circleTwo.classList.remove("active");
} }
} }
if (circleThree) { if (circleThree) {
circleThree.classList.add("active"); circleThree.classList.add("active");
} }
} }
window.addEventListener("hashchange", () => { window.addEventListener("hashchange", () => {
if (window.location.hash == "#/cart") { if (window.location.hash == "#/cart") {
if (circleOne) { if (circleOne) {
circleOne.classList.add("active"); circleOne.classList.add("active");
} }
if (circleTwo) { if (circleTwo) {
if (circleTwo.classList.contains("active")) { if (circleTwo.classList.contains("active")) {
circleTwo.classList.remove("active"); circleTwo.classList.remove("active");
@ -162,7 +157,6 @@ export default class Header {
circleOne.classList.remove("active"); circleOne.classList.remove("active");
} }
} }
if (circleTwo) { if (circleTwo) {
if (circleTwo.classList.contains("active")) { if (circleTwo.classList.contains("active")) {
circleTwo.classList.remove("active"); circleTwo.classList.remove("active");