summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/jobs/components/empty_state.vue
blob: ee5ceb99b0a4c69d767e1526a6f714d157b0a610 (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
<script>
export default {
  props: {
    illustrationPath: {
      type: String,
      required: true,
    },
    illustrationSizeClass: {
      type: String,
      required: true,
    },
    title: {
      type: String,
      required: true,
    },
    content: {
      type: String,
      required: false,
      default: null,
    },
    action: {
      type: Object,
      required: false,
      default: null,
      validator(value) {
        return (
          value === null ||
          (Object.prototype.hasOwnProperty.call(value, 'path') &&
            Object.prototype.hasOwnProperty.call(value, 'method') &&
            Object.prototype.hasOwnProperty.call(value, 'button_title'))
        );
      },
    },
  },
};
</script>
<template>
  <div class="row empty-state">
    <div class="col-12">
      <div
        :class="illustrationSizeClass"
        class="svg-content"
      >
        <img :src="illustrationPath" />
      </div>
    </div>

    <div class="col-12">
      <div class="text-content">
        <h4 class="js-job-empty-state-title text-center">
          {{ title }}
        </h4>

        <p
          v-if="content"
          class="js-job-empty-state-content"
        >
          {{ content }}
        </p>

        <div
          v-if="action"
          class="text-center"
        >
          <a
            :href="action.path"
            :data-method="action.method"
            class="js-job-empty-state-action btn btn-primary"
          >
            {{ action.button_title }}
          </a>
        </div>
      </div>
    </div>
  </div>
</template>