From f65a12c2824bed51bd363393780a2a158af18f5e Mon Sep 17 00:00:00 2001
From: Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>
Date: Thu, 17 Oct 2019 21:30:20 +0200
Subject: Add chronicle to navbar

---
 layouts/default.vue | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'layouts/default.vue')

diff --git a/layouts/default.vue b/layouts/default.vue
index 8feaff6..3341547 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -21,10 +21,10 @@ export default {
   data() {
     return {
       routes: [
-        { path: '/', name: 'Home' },
-        { path: '/o-nas', name: 'O nas' },
+        { path: '/', name: 'Strona główna' },
         { path: '/download', name: 'Do pobrania' },
-        { path: '/kontakt', name: 'Kontakt' }
+        { path: '/kontakt', name: 'Kontakt' },
+        { path: '/kronika', name: 'Kronika' }
       ],
       externalRoutes: [
         // {
-- 
cgit 1.4.1


From 5cbfdab567005a963ef3c4f1ee4f1412f9c0de47 Mon Sep 17 00:00:00 2001
From: Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>
Date: Thu, 17 Oct 2019 21:56:13 +0200
Subject: Fix empty post list

---
 components/NavBar.vue  | 14 +++++++++++---
 components/NavLink.vue |  4 +++-
 layouts/default.vue    |  8 ++++----
 3 files changed, 18 insertions(+), 8 deletions(-)

(limited to 'layouts/default.vue')

diff --git a/components/NavBar.vue b/components/NavBar.vue
index 2887464..4ffdf16 100644
--- a/components/NavBar.vue
+++ b/components/NavBar.vue
@@ -8,14 +8,21 @@
     <button @click="toggleMenu" class="menu-toggler">Menu</button>
     <ul :class="linksClass" @click="toggleMenu">
       <!-- Loop for generating links -->
-      <NavLink v-for="route in routes" :key="route.path" :link="route.path" :name="route.name"></NavLink>
+      <NavLink v-for="route in routes" :key="route.path" :link="route.path" :name="route.name" />
+      <NavLink
+        v-for="route in staticRoutes"
+        :key="route.path"
+        :link="route.path"
+        :name="route.name"
+        static
+      />
       <NavLink
         v-for="route in externalRoutes"
         :key="route.path"
         :link="route.path"
         :name="route.name"
-        :external="true"
-      ></NavLink>
+        external
+      />
     </ul>
   </nav>
 </template>
@@ -30,6 +37,7 @@ export default {
   props: {
     routes: Array,
     externalRoutes: Array,
+    staticRoutes: Array,
     title: String,
     logo: String
   },
diff --git a/components/NavLink.vue b/components/NavLink.vue
index 253dde9..6074db0 100644
--- a/components/NavLink.vue
+++ b/components/NavLink.vue
@@ -1,6 +1,7 @@
 <template>
   <li class="navlink">
     <a v-if="external" class="link" target="_blank" rel="”noopener”" :href="link">{{ name }}</a>
+    <a v-else-if="static" class="link" :href="link">{{ name }}</a>
     <nuxt-link v-else class="link" :to="link">{{ name }}</nuxt-link>
   </li>
 </template>
@@ -10,7 +11,8 @@ export default {
   props: {
     link: String,
     name: String,
-    external: { type: Boolean, default: false }
+    external: { type: Boolean, default: false },
+    static: { type: Boolean, default: false }
   }
 }
 </script>
diff --git a/layouts/default.vue b/layouts/default.vue
index 3341547..7f9ec5b 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -2,11 +2,11 @@
   <div id="app">
     <NavBar
       :routes="routes"
-      :externalRoutes="externalRoutes"
+      :staticRoutes="staticRoutes"
       title="19 PDH Puszcza"
       logo="/assets/krajka-logo.svg"
     />
-    <nuxt id="content" />
+    <nuxt id="content" :key="$route.path" />
     <Footer :routes="routes" :specialRoutes="specialRoutes" />
   </div>
 </template>
@@ -23,9 +23,9 @@ export default {
       routes: [
         { path: '/', name: 'Strona główna' },
         { path: '/download', name: 'Do pobrania' },
-        { path: '/kontakt', name: 'Kontakt' },
-        { path: '/kronika', name: 'Kronika' }
+        { path: '/kontakt', name: 'Kontakt' }
       ],
+      staticRoutes: [{ path: '/kronika', name: 'Kronika' }],
       externalRoutes: [
         // {
         //   path: 'https://kronika-puszcza.netlify.com',
-- 
cgit 1.4.1


From ab22672cb9911b7dda59acc4557237b835926816 Mon Sep 17 00:00:00 2001
From: Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>
Date: Sat, 19 Oct 2019 13:49:25 +0200
Subject: Add style to list of posts

---
 components/ChroniclePost.vue                     | 60 ++++++++++++++++++++++++
 layouts/default.vue                              |  5 +-
 pages/kronika/_year/_month/_day/_title/index.vue |  2 +-
 pages/kronika/index.vue                          | 40 +++++++++++++++-
 4 files changed, 102 insertions(+), 5 deletions(-)
 create mode 100644 components/ChroniclePost.vue

(limited to 'layouts/default.vue')

diff --git a/components/ChroniclePost.vue b/components/ChroniclePost.vue
new file mode 100644
index 0000000..7b2c527
--- /dev/null
+++ b/components/ChroniclePost.vue
@@ -0,0 +1,60 @@
+<template>
+  <a :href="route" class="post">
+    <div>
+      <h4 class="post-title">{{title}}</h4>
+      <p class="post-description">{{shortenedDescription}}...</p>
+    </div>
+  </a>
+</template>
+
+<script>
+export default {
+  name: 'ChroniclePost',
+  props: {
+    title: {
+      type: String,
+      required: true
+    },
+    description: {
+      type: String,
+      default: ''
+    },
+    route: {
+      type: String,
+      required: true
+    }
+  },
+  computed: {
+    shortenedDescription() {
+      const first30Words = this.description.split(' ').slice(0, 30)
+      return first30Words.join(' ')
+    }
+  }
+}
+</script>
+
+<style scoped>
+.post {
+  margin: 20px;
+  flex-basis: 410px;
+  text-decoration: none;
+}
+
+.post > div {
+  background: #ffffff;
+  box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.25);
+  padding: 20px;
+
+  text-align: left;
+}
+
+.post-title {
+  color: #181818;
+  font-size: 1.3em;
+}
+
+.post-description {
+  color: #484848;
+  font-size: 0.9em;
+}
+</style>
\ No newline at end of file
diff --git a/layouts/default.vue b/layouts/default.vue
index 7f9ec5b..496f1ba 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -23,9 +23,10 @@ export default {
       routes: [
         { path: '/', name: 'Strona główna' },
         { path: '/download', name: 'Do pobrania' },
-        { path: '/kontakt', name: 'Kontakt' }
+        { path: '/kontakt', name: 'Kontakt' },
+        { path: '/kronika', name: 'Kronika' }
       ],
-      staticRoutes: [{ path: '/kronika', name: 'Kronika' }],
+      staticRoutes: [],
       externalRoutes: [
         // {
         //   path: 'https://kronika-puszcza.netlify.com',
diff --git a/pages/kronika/_year/_month/_day/_title/index.vue b/pages/kronika/_year/_month/_day/_title/index.vue
index 361b7f8..1308eb7 100644
--- a/pages/kronika/_year/_month/_day/_title/index.vue
+++ b/pages/kronika/_year/_month/_day/_title/index.vue
@@ -7,7 +7,7 @@
     <div v-else class="article">
       <!-- <h1>{{ params.title }}</h1>
       <span>{{ `${params.year}-${params.month}-${params.day}` }}</span>-->
-      <div class="content" v-html="content"></div>
+      <article class="content" v-html="content"></article>
     </div>
   </div>
 </template>
diff --git a/pages/kronika/index.vue b/pages/kronika/index.vue
index 4bb6910..f61e615 100644
--- a/pages/kronika/index.vue
+++ b/pages/kronika/index.vue
@@ -1,18 +1,54 @@
 <template>
   <div style="padding-top: 20px">
     <h2>Ostatnie wpisy</h2>
-    <a v-for="(post, index) in posts" :key="index" :href="post.route">{{post.content.meta.title}}</a>
+    <div class="post-list">
+      <chronicle-post
+        v-for="(post, index) in posts"
+        :key="index"
+        :route="post.route"
+        :title="post.content.meta.title"
+        :description="post.content.description"
+      />
+    </div>
   </div>
 </template>
 
 <script>
+import ChroniclePost from '~/components/ChroniclePost'
 import k from '~/api'
 
+const URL = process.env.DEPLOY_URL || 'http://localhost:8080'
+
 export default {
+  components: {
+    ChroniclePost
+  },
   async asyncData() {
     return {
       posts: k.getPosts()
     }
+  },
+  mounted() {
+    this.getPosts()
+  },
+  methods: {
+    getPosts() {
+      if (this.posts.length < 1) {
+        this.$axios
+          .get(`${URL}/api/posts.json`)
+          .then(r => (this.posts = r.data))
+      }
+      console.log(this.posts)
+    }
   }
 }
-</script>
\ No newline at end of file
+</script>
+
+<style scoped>
+.post-list {
+  display: flex;
+  flex-wrap: wrap;
+  justify-content: center;
+  max-width: 900px;
+}
+</style>
\ No newline at end of file
-- 
cgit 1.4.1


From 160e3897b89252095e2e206ca8c90426a179282f Mon Sep 17 00:00:00 2001
From: Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>
Date: Sun, 20 Oct 2019 22:34:02 +0200
Subject: Remove unused variables in default layout

---
 layouts/default.vue | 23 ++---------------------
 1 file changed, 2 insertions(+), 21 deletions(-)

(limited to 'layouts/default.vue')

diff --git a/layouts/default.vue b/layouts/default.vue
index 496f1ba..0e5ca9c 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -1,13 +1,8 @@
 <template>
   <div id="app">
-    <NavBar
-      :routes="routes"
-      :staticRoutes="staticRoutes"
-      title="19 PDH Puszcza"
-      logo="/assets/krajka-logo.svg"
-    />
+    <NavBar :routes="routes" title="19 PDH Puszcza" logo="/assets/krajka-logo.svg" />
     <nuxt id="content" :key="$route.path" />
-    <Footer :routes="routes" :specialRoutes="specialRoutes" />
+    <Footer :routes="routes" />
   </div>
 </template>
 
@@ -25,20 +20,6 @@ export default {
         { path: '/download', name: 'Do pobrania' },
         { path: '/kontakt', name: 'Kontakt' },
         { path: '/kronika', name: 'Kronika' }
-      ],
-      staticRoutes: [],
-      externalRoutes: [
-        // {
-        //   path: 'https://kronika-puszcza.netlify.com',
-        //   name: 'Kronika'
-        // },
-        // { path: 'https://kronika-puszcza.netlify.com/galeria', name: 'Galeria' }
-      ],
-      specialRoutes: [
-        // {
-        //   name: 'Akcja "Ratujmy pszczoły"',
-        //   path: "/ratujmy-pszczoly"
-        // }
       ]
     }
   }
-- 
cgit 1.4.1

