about summary refs log tree commit diff
path: root/components/Posts/PostList/PostList.vue
blob: 64070d87aef44daddcf0e7a803c9790a4db1bcba (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
35
36
37
38
<template>
  <pure-post-list v-if="posts" :next="next" :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
    },
    next: {
      type: Number,
      required: false
    }
  },
  computed: {
    parsedPosts() {
      if (this.max) {
        return this.posts.slice(0, this.max)
      }
      return this.posts
    },
    loading() {
      return this.posts === undefined
    }
  }
}
</script>