Просмотр исходного кода

Add button to return to inventory page

Lee Morgan 6 лет назад
Родитель
Сommit
7fddb46656
3 измененных файлов с 35 добавлено и 20 удалено
  1. 25 15
      views/recipesPage/recipes.css
  2. 9 2
      views/recipesPage/recipes.ejs
  3. 1 3
      views/recipesPage/recipes.js

+ 25 - 15
views/recipesPage/recipes.css

@@ -15,27 +15,37 @@ h2{
 
 #recipes{
     display: flex;
-    justify-content: space-around;
-    flex-wrap: wrap;
-    padding: 25px;
+    flex-direction: column;
+    align-items: center;
 }
 
-    .recipe-card{
-        border: 2px solid #ff626b;
-        box-shadow: 2px 2px 2px #001b2d;
-        background: #001b2d;
-        color: #ff626b;
-        width: 20%;
-        padding: 35px;
-        margin: 25px;
-        border-radius: 10px;
-        cursor: pointer;
+    #recipeUpdate{
+        margin-bottom: 10px;
     }
 
-        .recipe-card:hover{
-            transform: translateY(-3px);
+    #recipesContainer{
+        display: flex;
+        justify-content: space-around;
+        flex-wrap: wrap;
+        padding: 25px;
+    }
+
+        .recipe-card{
+            border: 2px solid #ff626b;
+            box-shadow: 2px 2px 2px #001b2d;
+            background: #001b2d;
+            color: #ff626b;
+            width: 20%;
+            padding: 35px;
+            margin: 25px;
+            border-radius: 10px;
+            cursor: pointer;
         }
 
+            .recipe-card:hover{
+                transform: translateY(-3px);
+            }
+
 #ingredient{
     display: none;
     width: 50%;

+ 9 - 2
views/recipesPage/recipes.ejs

@@ -11,9 +11,16 @@
 
         <h1 id="title">Recipes</h1>
 
-        <button id="recipeUpdate" onclick="recipesPage.updateRecipes()">Update Recipes</button>
+        
 
-        <div id="recipes" class="container"></div>
+        <div id="recipes">
+            <button id="recipeUpdate" onclick="recipesPage.updateRecipes()">Update Recipes</button>
+            <a href="/">Return to Inventory</a>
+
+            <div id="recipesContainer">
+
+            </div>
+        </div>
 
         <div id="ingredient" >
             <button id="addButton">Add Ingredient</button>

+ 1 - 3
views/recipesPage/recipes.js

@@ -1,7 +1,7 @@
 let recipesPage = {
     //Display all recipes on a card
     displayRecipes: function(){
-        let body = document.querySelector(".container");
+        let body = document.querySelector("#recipesContainer");
         let recipeUpdate = document.querySelector("#recipeUpdate");
 
         recipeUpdate.style.display = "inline-block";
@@ -37,7 +37,6 @@ let recipesPage = {
         let ingredientDiv = document.querySelector("#ingredient");
         let tbody = document.querySelector("tbody");
         let title = document.querySelector("#title");
-        let recipeUpdate = document.querySelector("#recipeUpdate");
 
         while(tbody.children.length > 0){
             tbody.removeChild(tbody.firstChild);
@@ -50,7 +49,6 @@ let recipesPage = {
 
         recipesDiv.style.display = "none";
         ingredientDiv.style.display = "flex";
-        recipeUpdate.style.display = "none";
 
         for(let ingredient of recipe.ingredients){
             let row = document.createElement("tr");