Merge pull request #24 from VladImpaler64/boton_menu
authorSalamandra Devs <120526408+SalamandraDevs@users.noreply.github.com>
Mon, 17 Apr 2023 21:59:56 +0000 (16:59 -0500)
committerGitHub <noreply@github.com>
Mon, 17 Apr 2023 21:59:56 +0000 (16:59 -0500)
Botón añadido al nav para abrir y cerrar el menú

static/images/menu-abierto.png [new file with mode: 0644]
static/images/menu.png [new file with mode: 0644]
themes/droda/assets/css/main.css
themes/droda/assets/js/main.js
themes/droda/layouts/_default/baseof.html
themes/droda/layouts/partials/aside.html
themes/droda/layouts/partials/navbar.html

diff --git a/static/images/menu-abierto.png b/static/images/menu-abierto.png
new file mode 100644 (file)
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 (file)
index 0000000..038acd5
Binary files /dev/null and b/static/images/menu.png differ
index 080d8366efd675c97b6b0c9733bc18493e91243d..288770d9572d388849edad0e5a70b3f6ea625615 100644 (file)
@@ -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) {
index 1315b0c9a643be3ec54b846a7614a42518a982dc..37ebccc1971976efc7419e556e9aca1f1117e58e 100644 (file)
@@ -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");
+    }
+});
index cbd82f86180064f3c4d1e152c940934bafa0db9d..87d2040f88fbc47c9c4c8b8e8820fc13e2cd5cd3 100644 (file)
@@ -12,7 +12,7 @@
     <link rel="stylesheet" href="{{ $homeStyles.Permalink }}">
     {{ "<!-- Main Script -->" | safeHTML }}
     {{ $mainScript := resources.Get "js/main.js" }}
-    <script src="{{ $mainScript.Permalink }}"></script>
+    <script src="{{ $mainScript.Permalink }}" defer></script>
     {{ "<!-- JS Thirparties -->" | safeHTML }}
     {{ range .Site.Params.plugins.js }}
     <script src="{{ .link | absURL }}" crossorigin="anonymous"></script>
index 67087259d5e28dc08b34c83e71d260e62ed229c2..c084298af3d906eac480b8b46444c724f053f21a 100644 (file)
@@ -5,4 +5,7 @@
     {{ .Pre }}<a href="{{ .URL }}" title="{{ .Identifier }}" target="_blank">{{ .Name }}</a>
   </div>
   {{ end }}
+  {{ range .Site.Sections }}
+    <li class="item"><a class="hover" href="{{ .Permalink }}">{{ .Title }}</a></li>
+  {{ end }}
 </aside>
index e77ce2fdb3f1048ee88d67ecfe3ee95e348346bc..1bfa934855b5a3497d29628b9396e5a252afe9b2 100644 (file)
@@ -8,4 +8,5 @@
   <li><a class="hover" href="{{ .Permalink }}">{{ .Title }}</a></li>
   {{ end }}
   </ul>
+  <button data-visible="false"></button>
 </nav>