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

runner_platforms_radio.vue « components « runner « ci « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 48c5d2f972175d7ef2edfbf7753883843e6de910 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<script>
import { GlFormRadio } from '@gitlab/ui';

export default {
  components: {
    GlFormRadio,
  },
  model: {
    event: 'input',
    prop: 'checked',
  },
  props: {
    image: {
      type: String,
      required: false,
      default: null,
    },
    checked: {
      type: String,
      required: false,
      default: null,
    },
    value: {
      type: String,
      required: false,
      default: null,
    },
  },
  computed: {
    isChecked() {
      return this.value && this.value === this.checked;
    },
    imgClass() {
      return 'gl-h-6 gl-mt-n2 gl-mr-2';
    },
  },
  methods: {
    onInput($event) {
      if (!$event) {
        return;
      }
      this.$emit('input', $event);
    },
    onChange($event) {
      this.$emit('change', $event);
    },
  },
};
</script>

<template>
  <div
    class="runner-platforms-radio gl-border gl-rounded-base gl-px-5 gl-pt-6 gl-pb-5"
    :class="{ 'gl-bg-blue-50 gl-border-blue-500': isChecked, 'gl-cursor-pointer': value }"
    @click="onInput(value)"
  >
    <gl-form-radio
      v-if="value"
      :checked="checked"
      :value="value"
      @input="onInput($event)"
      @change="onChange($event)"
    >
      <img v-if="image" :src="image" :class="imgClass" aria-hidden="true" />
      <span class="gl-font-weight-bold"><slot></slot></span>
    </gl-form-radio>
    <div v-else class="gl-mb-3">
      <img v-if="image" :src="image" :class="imgClass" aria-hidden="true" />
      <span class="gl-font-weight-bold"><slot></slot></span>
    </div>
  </div>
</template>

<style>
.runner-platforms-radio {
  min-width: 173px;
}
</style>