about summary refs log tree commit diff
path: root/components/Posts/PostList/PostList.vue
blob: 80369a8a7586878c14e1c4d0790993cffad2be05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<template>
  <pure-post-list v-if="posts" :posts="parsedPosts" :loading="loading" />
</template>

<script>
import PurePostList from './PurePostList'

export default {
  name: 'PostList',
  components: { PurePostList },
  props: {
    max: {
      type: Number,
      required: false,
      default: () => 4
    },
    posts: {
      type: Array,
      required: false
    }
  },
  computed: {
    parsedPosts() {
      if (this.max) {
        return this.posts.slice(0, this.max)
      }
      return this.posts
    },
    loading() {
      return this.posts === undefined
    }
  }
}
</script>