summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/pages/admin/application_settings/general/components/signup_checkbox.vue
blob: 2217792d7f354ec7d3a68c4d3f67eae00206d636 (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
<script>
import { GlFormCheckbox } from '@gitlab/ui';

export default {
  components: {
    GlFormCheckbox,
  },
  props: {
    name: {
      type: String,
      required: true,
    },
    helpText: {
      type: String,
      required: false,
      default: '',
    },
    label: {
      type: String,
      required: true,
    },
    value: {
      type: Boolean,
      required: true,
    },
    dataQaSelector: {
      type: String,
      required: false,
      default: '',
    },
  },
};
</script>

<template>
  <div>
    <input :name="name" type="hidden" :value="value ? '1' : '0'" data-testid="input" />

    <gl-form-checkbox
      :checked="value"
      :data-qa-selector="dataQaSelector"
      @input="$emit('input', $event)"
    >
      <span data-testid="label">{{ label }}</span>
      <template v-if="helpText" #help>
        <span data-testid="helpText">{{ helpText }}</span>
      </template>
    </gl-form-checkbox>
  </div>
</template>