Welcome to mirror list, hosted at ThFree Co, Russian Federation.

category.vue « components « emoji « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 39881979c4f7647ec57a895a4df089be18d0b462 (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
52
53
54
55
56
57
58
<script>
import { GlIntersectionObserver } from '@gitlab/ui';
import { humanize } from '~/lib/utils/text_utility';
import EmojiGroup from './emoji_group.vue';

export default {
  components: {
    GlIntersectionObserver,
    EmojiGroup,
  },
  props: {
    category: {
      type: String,
      required: true,
    },
    emojis: {
      type: Array,
      required: true,
    },
  },
  data() {
    return {
      renderGroup: false,
    };
  },
  computed: {
    categoryTitle() {
      return humanize(this.category);
    },
  },
  methods: {
    categoryAppeared() {
      this.renderGroup = true;
      this.$emit('appear', this.category);
    },
  },
};
</script>

<template>
  <gl-intersection-observer class="gl-px-5 gl-h-full" @appear="categoryAppeared">
    <div class="gl-top-0 gl-py-3 gl-w-full gl-z-index-1 emoji-picker-category-header">
      <b>{{ categoryTitle }}</b>
    </div>
    <template v-if="emojis.length">
      <emoji-group
        v-for="(emojiGroup, index) in emojis"
        :key="index"
        :emojis="emojiGroup"
        :render-group="renderGroup"
        :click-emoji="(emoji) => $emit('click', emoji)"
      />
    </template>
    <p v-else>
      {{ s__('AwardEmoji|No emojis found.') }}
    </p>
  </gl-intersection-observer>
</template>