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

association_count_card.vue « components « show « organizations « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0567f43132f32d9351ddf6d235ddfa0498135735 (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
<script>
import { GlIcon, GlLink, GlCard } from '@gitlab/ui';
import { numberToMetricPrefix } from '~/lib/utils/number_utils';
import { __ } from '~/locale';

export default {
  name: 'AssociationCountCard',
  components: { GlIcon, GlLink, GlCard },
  props: {
    title: {
      type: String,
      required: true,
    },
    iconName: {
      type: String,
      required: true,
    },
    count: {
      type: Number,
      required: true,
    },
    linkHref: {
      type: String,
      required: true,
    },
    linkText: {
      type: String,
      required: false,
      default: __('View all'),
    },
  },
  computed: {
    formattedCount() {
      return numberToMetricPrefix(this.count, 0);
    },
  },
};
</script>

<template>
  <gl-card>
    <div class="gl-display-flex gl-align-items-center gl-justify-content-space-between">
      <div class="gl-display-flex gl-align-items-center gl-text-gray-700">
        <gl-icon :name="iconName" />
        <span class="gl-ml-2">{{ title }}</span>
      </div>
      <gl-link :href="linkHref">{{ linkText }}</gl-link>
    </div>
    <span
      class="gl-font-size-h-display gl-font-weight-bold gl-line-height-ratio-1000 gl-mt-2 gl-display-block"
      >{{ formattedCount }}</span
    >
  </gl-card>
</template>