diff --git a/index.html b/index.html index 19be882..69c89b5 100644 --- a/index.html +++ b/index.html @@ -254,6 +254,6 @@

VISITA NUESTRO CANAL DE YOUTUBE

- + \ No newline at end of file diff --git a/pages/carrito.html b/pages/carrito.html index 8f761e9..a9a2981 100644 --- a/pages/carrito.html +++ b/pages/carrito.html @@ -43,6 +43,6 @@

TU CARRITO

- + \ No newline at end of file diff --git a/pages/miperfil.html b/pages/miperfil.html index 5634799..3a5989d 100644 --- a/pages/miperfil.html +++ b/pages/miperfil.html @@ -156,6 +156,6 @@

TUS ARTICULOS FAVORITOS

- + \ No newline at end of file diff --git a/pages/result.html b/pages/result.html index 1f521ae..2da2957 100644 --- a/pages/result.html +++ b/pages/result.html @@ -35,7 +35,7 @@ - + \ No newline at end of file diff --git a/pages/tienda.html b/pages/tienda.html index b06fdcf..3f31bd6 100644 --- a/pages/tienda.html +++ b/pages/tienda.html @@ -127,6 +127,6 @@

TIENDA

- + \ No newline at end of file diff --git a/script/main.js b/script/main.js new file mode 100644 index 0000000..b67c490 --- /dev/null +++ b/script/main.js @@ -0,0 +1,37 @@ + +// accediendo a el local storage + +window.onload = function(){ + // verificando que tema tiene en el local storage + tema = localStorage.getItem("tema") + console.log(tema) + header.style.backgroundColor = tema +} + +// trayendo la barra de busqueda con el id +const search_bar = document.getElementById("busqueda") +const products_url_main = "../products.json" +let show_product + +fetch(products_url_main) +.then(response => response.json()) +.then(data=>{ + search_bar.addEventListener("keydown",(event)=>{ + if (event.key === "Enter"){ + console.log("entro") + const result = search_bar.value.toLowerCase() + console.log(result) + let show_product = data.filter(product=>product.name.toLowerCase().includes(result.toLowerCase())) + show_product.forEach((product=>{ + console.log(product) + + })) + show_product_str = JSON.stringify(show_product) + localStorage.setItem('search', show_product_str) + window.location.href = "../pages/result.html" + } + }) +}) +.catch(error => console.log("Error con la carga de data en filtro de busqueda")) + +