From 671d0a7755bbcfae128fa148b74d1fb5e4d57b1e Mon Sep 17 00:00:00 2001 From: Diego Manoel Date: Mon, 17 Nov 2025 15:11:21 -0300 Subject: [PATCH 01/10] refactor: Atualizados caminhos de header-componente --- src/header-componente.js | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/header-componente.js b/src/header-componente.js index 030616c..0ab901e 100644 --- a/src/header-componente.js +++ b/src/header-componente.js @@ -1,4 +1,8 @@ -const caminhoAtual = window.location.pathname.split("/").pop(); //Seleciona o caminho atual. +const partes = window.location.pathname.split("/"); +const caminhoAtual = partes.pop(); //Seleciona o caminho atual. +const pastaAtual = partes.pop(); //Seleciona o caminho atual. + +const dentroDeSrc = pastaAtual === "src"; //Informa se está no src class Header extends HTMLElement { connectedCallback(){ @@ -28,18 +32,11 @@ class Header extends HTMLElement { "avancado-cloud-computing.html" ]; - let inicianteLink = "" - let intermediarioLink = "" - let avancadoLink = "" - if(caminhoAtual === "index.html"){ - inicianteLink = '"href="src/iniciante.html"' - intermediarioLink = '"href="src/intermediario.html"' - avancadoLink = '"href="src/avancado.html"' - }else { - inicianteLink = '"href="iniciante.html"' - intermediarioLink = '"href="intermediario.html"' - avancadoLink = '"href="avancado.html"' - } + const base = dentroDeSrc ? "../" : ""; + + const inicianteLink = `href="${base}src/iniciante.html"`; + const intermediarioLink = `href="${base}src/intermediario.html"`; + const avancadoLink = `href="${base}src/avancado.html"`; //data-bs-theme="light" estava travando o tema no "light" //troquei a class="logo-light" por class="logo-img" para trocar a logo caso tema 'dark' @@ -53,8 +50,8 @@ class Header extends HTMLElement { - - MapaDev + + MapaDev