aboutsummaryrefslogtreecommitdiff
path: root/src/components/mentions_line/mentions_line.js
blob: a4a0c7246fd7c4134594384cdb0905309cce5e57 (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
import MentionLink from 'src/components/mention_link/mention_link.vue'
import { mapGetters } from 'vuex'

export const MENTIONS_LIMIT = 5

const MentionsLine = {
  name: 'MentionsLine',
  props: {
    mentions: {
      required: true,
      type: Array
    }
  },
  data: () => ({ expanded: false }),
  components: {
    MentionLink
  },
  computed: {
    mentionsComputed () {
      return this.mentions.slice(0, MENTIONS_LIMIT)
    },
    extraMentions () {
      return this.mentions.slice(MENTIONS_LIMIT)
    },
    manyMentions () {
      return this.extraMentions.length > 0
    },
    ...mapGetters(['mergedConfig'])
  },
  methods: {
    toggleShowMore () {
      this.expanded = !this.expanded
    }
  }
}

export default MentionsLine