From: Salamandra Devs <120526408+SalamandraDevs@users.noreply.github.com> Date: Mon, 17 Apr 2023 21:59:56 +0000 (-0500) Subject: Merge pull request #24 from VladImpaler64/boton_menu X-Git-Url: https://git.josue.xyz/?a=commitdiff_plain;h=494ee7e4d8657c7f59ef6db26faa8b6316ed6598;hp=f9742f0958ed05f624005f1474e0ebcd122254a0;p=salamandradevs.site%2F.git Merge pull request #24 from VladImpaler64/boton_menu Botón añadido al nav para abrir y cerrar el menú --- diff --git a/static/images/menu-abierto.png b/static/images/menu-abierto.png new file mode 100644 index 0000000..400bf2a Binary files /dev/null and b/static/images/menu-abierto.png differ diff --git a/static/images/menu.png b/static/images/menu.png new file mode 100644 index 0000000..038acd5 Binary files /dev/null and b/static/images/menu.png differ diff --git a/themes/droda/assets/css/main.css b/themes/droda/assets/css/main.css index 080d836..288770d 100644 --- a/themes/droda/assets/css/main.css +++ b/themes/droda/assets/css/main.css @@ -22,6 +22,8 @@ --bgColorMidDark: #353b43; --bgColorLightDark: #4f5864; --bgColorLight: #D2D2D2; + --bgColorBlue: #1b6694; + --bgColorSalamandra: rgb(236, 162, 143); --globalScale: 1; } @@ -57,6 +59,7 @@ a:hover, a:active { text-decoration: none; font-size: 1.5rem; + color: var(--bgColorSalamandra); } html { @@ -78,20 +81,34 @@ body { height: 100%; } +::-webkit-scrollbar { + width: 0.35rem; +} + +::-webkit-scrollbar-thumb { + background-color: var(--bgColorBlue); +} + aside { + position: fixed; + inset: 0 calc(100% - 18rem); grid-area: aside; display: none; flex-flow: column nowrap; align-items: flex-start; justify-content: flex-start; - width: 100%; - padding: 0 1rem; + width: 18rem; + height: calc(100% - 5rem); + margin-top: 5rem; + padding: 2rem 1rem; background-color: var(--bgColorDark); + overflow: auto; } aside .item { + color: var(--bgColorLight); display: flex; - flex-flow: row nowrap; + flex-flow: column nowrap; align-items: center; justify-content: space-between; font-size: 1.5rem; @@ -122,7 +139,7 @@ nav div img:first-child { } nav ul { - display: flex; + display: none; flex-flow: row nowrap; align-items: center; justify-content: flex-end; @@ -164,6 +181,30 @@ nav a { text-decoration: none; } +nav button { + display: flex; + position: absolute; + width: 4rem; + height: 4rem; + right: 0.4rem; + + background-image: url('../images/menu.png'); + background-color: transparent; /* Cuando usamos background-image se pone el background-color en blanco por default por eso le indicamos que sea transparente para que se pueda ver la imagen. */ + background-position: top left; + background-repeat: no-repeat; + background-size: cover; + + border: none; + cursor: pointer; + + transition: background-image ease 0.2s; + +} + +nav button[data-visible="true"] { + background-image: url('../images/menu-abierto.png'); +} + main { grid-area: main; padding: 2rem; @@ -242,16 +283,25 @@ footer { } body { - grid-template-columns: 11rem 1fr; + grid-template-columns: 13rem 1fr; grid-template-areas: /* Tabletas se muestra el aside */ "navbar navbar" - "aside main" + "main main" "footer footer"; } - aside { + nav ul { display: flex; } + + aside { + display: none; + } + + nav button, aside li a { + display: none; + } + } @media screen and (min-width: 1280px) { diff --git a/themes/droda/assets/js/main.js b/themes/droda/assets/js/main.js index 1315b0c..37ebccc 100644 --- a/themes/droda/assets/js/main.js +++ b/themes/droda/assets/js/main.js @@ -1,4 +1,16 @@ // CODE SECTION: greetings const title = document.querySelector("title"); +const hamButton = document.querySelector("nav button"); +const aside = document.querySelector("aside"); console.log("Gracias por visitar a " + title.innerHTML); + +hamButton.addEventListener("click", (e)=>{ + if(e.target.attributes[0].nodeValue === 'true'){ + e.target.attributes[0].nodeValue = false; + aside.setAttribute("style", "display: none"); + } else { + e.target.attributes[0].nodeValue = true; + aside.setAttribute("style", "display: flex"); + } +}); diff --git a/themes/droda/layouts/_default/baseof.html b/themes/droda/layouts/_default/baseof.html index cbd82f8..87d2040 100644 --- a/themes/droda/layouts/_default/baseof.html +++ b/themes/droda/layouts/_default/baseof.html @@ -12,7 +12,7 @@ {{ "" | safeHTML }} {{ $mainScript := resources.Get "js/main.js" }} - + {{ "" | safeHTML }} {{ range .Site.Params.plugins.js }} diff --git a/themes/droda/layouts/partials/aside.html b/themes/droda/layouts/partials/aside.html index 6708725..c084298 100644 --- a/themes/droda/layouts/partials/aside.html +++ b/themes/droda/layouts/partials/aside.html @@ -5,4 +5,7 @@ {{ .Pre }}{{ .Name }} {{ end }} + {{ range .Site.Sections }} +
  • {{ .Title }}
  • + {{ end }} diff --git a/themes/droda/layouts/partials/navbar.html b/themes/droda/layouts/partials/navbar.html index e77ce2f..1bfa934 100644 --- a/themes/droda/layouts/partials/navbar.html +++ b/themes/droda/layouts/partials/navbar.html @@ -8,4 +8,5 @@
  • {{ .Title }}
  • {{ end }} +