Browse Source

Add style to image display.

Lee Morgan 5 years ago
parent
commit
664a36cf4f
3 changed files with 33 additions and 0 deletions
  1. 1 0
      routes.js
  2. 19 0
      views/travel/index.css
  3. 13 0
      views/travel/index.html

+ 1 - 0
routes.js

@@ -34,6 +34,7 @@ module.exports = function(app){
     app.get("/birthdayparadox/code", (req, res)=>{res.sendFile(`${views}/birthdayParadox/index.js`)});
 
     //TRAVEL
+    app.get("/travel/style", (req, res)=>{res.sendFile(`${views}/travel/index.css`)});
     app.get("/travel/directories", travel.listDirectories);
     app.get("/travel/images/*", travel.getImages);
     app.get("/travel/*", (req, res)=>res.sendFile(`${views}/travel/index.html`));

+ 19 - 0
views/travel/index.css

@@ -0,0 +1,19 @@
+*{margin:0;padding:0;}
+
+h1{
+    margin: 25px 0;
+    text-align: center;
+    border-bottom: 2px solid black;
+}
+
+#images{
+    display: flex;
+    flex-wrap: wrap;
+    justify-content: space-around;
+    width: 100vw;
+}
+
+    #images > *{
+        max-height: 250px;
+        padding: 25px;
+    }

+ 13 - 0
views/travel/index.html

@@ -3,8 +3,11 @@
     <head>
         <meta charset="utf-8">
         <title>Lee Morgan</title>
+        <link rel="stylesheet" href="/travel/style">
     </head>
     <body>
+        <h1 id="title"></h1>
+
         <div id="images"></div>
 
         <script>
@@ -26,6 +29,16 @@
                     }
                 })
                 .catch(err => {});
+
+            let newPath = path.split("/");
+            console.log(newPath);
+            let title = "";
+
+            for(let i = newPath.length - 1; i >= 0; i--){
+                title += `${newPath[i].replaceAll("-", " ")}, `;
+            }
+
+            document.getElementById("title").innerText = title.substring(0, title.length-2);
         </script>
     </body>
 </html>