about summary refs log tree commit diff
path: root/components/Posts/PostLink.vue
diff options
context:
space:
mode:
authorPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2020-01-28 19:42:12 +0100
committerPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2020-01-28 19:42:12 +0100
commit4ffad967152136c69f1ef904dcfb02270a7e57a1 (patch)
tree567077e1a50d4e46d714b55b153f4aeb32974663 /components/Posts/PostLink.vue
parent0ed99e6c969119440b333cc961f4c312ee62731b (diff)
parent5305c18b05803bf0d032027e645c71ac59627621 (diff)
downloadpuszcza-4ffad967152136c69f1ef904dcfb02270a7e57a1.tar.gz
puszcza-4ffad967152136c69f1ef904dcfb02270a7e57a1.zip
Merge remote-tracking branch 'origin/develop' into feature/json-api
Diffstat (limited to 'components/Posts/PostLink.vue')
-rw-r--r--components/Posts/PostLink.vue37
1 files changed, 27 insertions, 10 deletions
diff --git a/components/Posts/PostLink.vue b/components/Posts/PostLink.vue
index d3b34fc..0361b80 100644
--- a/components/Posts/PostLink.vue
+++ b/components/Posts/PostLink.vue
@@ -1,9 +1,12 @@
 <template>
   <div class="post-link">
     <nuxt-link :to="route">
-      <div class="post-container">
-        <h4 class="post-title">{{ title }}</h4>
-        <p class="post-description">{{ shortenedDescription }}...</p>
+      <div>
+        <div class="image" :style="`background-image: url('${image}')`" />
+        <div class="post-container">
+          <h4 class="post-title">{{ title }}</h4>
+          <p class="post-description">{{ shortenedDescription }}...</p>
+        </div>
       </div>
     </nuxt-link>
   </div>
@@ -15,23 +18,28 @@ export default {
   props: {
     title: {
       type: String,
-      required: true
+      required: true,
     },
     description: {
       type: String,
-      default: ''
+      default: '',
     },
     route: {
       type: String,
-      required: true
-    }
+      required: true,
+    },
+    image: {
+      type: String,
+      required: false,
+      default: () => '/assets/og/default.jpg',
+    },
   },
   computed: {
     shortenedDescription() {
       const first30Words = this.description.split(' ').slice(0, 30)
       return first30Words.join(' ')
-    }
-  }
+    },
+  },
 }
 </script>
 
@@ -44,7 +52,7 @@ export default {
   box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.25);
   background: #ffffff;
   text-align: left;
-  transition: transform 300ms ease-in-out;
+  transition: all 300ms ease-in-out;
 }
 
 .post-link:hover {
@@ -60,6 +68,7 @@ export default {
 .post-link .post-container {
   padding: 20px;
   height: 100%;
+  padding-top: 0;
 }
 
 .post-link .post-title {
@@ -71,4 +80,12 @@ export default {
   color: #484848;
   font-size: 0.9em;
 }
+
+.post-link .image {
+  height: 300px;
+  background-repeat: no-repeat;
+  background-size: cover;
+  background-position: center;
+  box-shadow: inset 0px 0px 100px rgba(0, 0, 0, 0.25);
+}
 </style>