aboutsummaryrefslogtreecommitdiff
path: root/src/components/mentions_line/mentions_line.js
blob: e52045ec80d1c99c8135e2f192a34ba4d0c7f900 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
import MentionLink from 'src/components/mention_link/mention_link.vue'
import { mapGetters } from 'vuex'

const MentionsLine = {
  name: 'MentionsLine',
  props: {
    mentions: {
      required: true,
      type: Array
    }
  },
  data: () => ({ expanded: false }),
  components: {
    MentionLink
  },
  computed: {
    oldStyle () {
      return !this.mergedConfig.mentionsNewStyle
    },
    limit () {
      return 6
    },
    mentionsComputed () {
      return this.mentions.slice(0, this.limit)
    },
    extraMentions () {
      return this.mentions.slice(this.limit)
    },
    manyMentions () {
      return this.extraMentions.length > 0
    },
    buttonClasses () {
      return [
        this.oldStyle
          ? 'button-unstyled'
          : 'button-default -sublime',
        this.oldStyle
          ? '-oldStyle'
          : '-newStyle'
      ]
    },
    ...mapGetters(['mergedConfig'])
  },
  methods: {
    toggleShowMore () {
      this.expanded = !this.expanded
    }
  }
}

export default MentionsLine