Explorar o código

Fix style of links when the menu is minified.
Bug fix: the correct menu head was not displaying after menu was minified and then normalized again.

Lee Morgan %!s(int64=5) %!d(string=hai) anos
pai
achega
03743f26b3
Modificáronse 2 ficheiros con 18 adicións e 3 borrados
  1. 2 2
      views/dashboardPage/ejs/menu.ejs
  2. 16 1
      views/dashboardPage/js/dashboard.js

+ 2 - 2
views/dashboardPage/ejs/menu.ejs

@@ -5,7 +5,7 @@
             <p>THE SUBLINE</p>
         </a>
 
-        <button class="menuShifter" onclick="controller.changeMenu()">&#8801;</button>
+        <button id="menuShifter" class="menuShifter">&#8801;</button>
     </div>
 
     <p id="menuLocationName"></p>
@@ -85,7 +85,7 @@
         <p>LOGOUT</p>
     </a>
 
-    <div class="menuLinks">
+    <div id="menuLinks" class="menuLinks">
         <button id="feedbackButton">Leave Feedback</button>
 
         <a href="/help">Help</a>

+ 16 - 1
views/dashboardPage/js/dashboard.js

@@ -290,7 +290,11 @@ controller = {
     changeMenu: function(){
         let menu = document.querySelector(".menu");
         let buttons = document.querySelectorAll(".menuButton");
+        let links = document.getElementById("menuLinks");
+        let merchantName = document.getElementById("menuLocationName");
+
         if(!menu.classList.contains("menuMinimized")){
+            merchantName.style.display = "none";
             menu.classList = "menu menuMinimized";
 
             for(let i = 0; i < buttons.length; i++){
@@ -299,15 +303,24 @@ controller = {
 
             document.getElementById("max").style.display = "none";
             document.getElementById("min").style.display = "flex";
-
+            
+            links.children[0].style.fontSize = "12px";
+            links.children[1].style.display = "none";
             
         }else if(menu.classList.contains("menuMinimized")){
+            merchantName.style.display = "block";
             menu.classList = "menu";
 
             for(let i = 0; i < buttons.length; i++){
                 buttons[i].children[1].style.display = "block";
             }
 
+            document.getElementById("max").style.display = "flex";
+            document.getElementById("min").style.display = "none";
+
+            links.childre[0].style.fontSize = "16px";
+            links.children[1].style.display = "block";
+
             setTimeout(()=>{
                 document.getElementById("max").style.display = "flex";
                 document.getElementById("min").style.display = "none";
@@ -363,6 +376,8 @@ window.state = {
 }
 
 //Add click listeners for menu buttons
+document.getElementById("menuShifter").onclick = ()=>{controller.changeMenu()}
+document.getElementById("menuShifter2").onclick = ()=>{controller.changeMenu()}
 document.getElementById("homeBtn").onclick = ()=>{controller.openStrand("home")};
 document.getElementById("ingredientsBtn").onclick = ()=>{controller.openStrand("ingredients")};
 document.getElementById("recipeBookBtn").onclick = ()=>{controller.openStrand("recipeBook")};