summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/vue_merge_request_widget/components/state_container.vue
blob: 4a5a03fb5988a410cf3cdb6dc5e7b03a78c97604 (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
<script>
import StatusIcon from './mr_widget_status_icon.vue';
import Actions from './action_buttons.vue';

export default {
  components: {
    StatusIcon,
    Actions,
  },
  props: {
    isLoading: {
      type: Boolean,
      required: false,
      default: false,
    },
    status: {
      type: String,
      required: false,
      default: '',
    },
    actions: {
      type: Array,
      required: false,
      default: () => [],
    },
  },
};
</script>

<template>
  <div class="mr-widget-body media">
    <div v-if="isLoading" class="gl-w-full mr-conflict-loader">
      <slot name="loading"></slot>
    </div>
    <template v-else>
      <slot name="icon">
        <status-icon :status="status" />
      </slot>
      <div
        :class="{ 'gl-display-flex': actions.length, 'gl-md-display-flex': !actions.length }"
        class="media-body"
      >
        <slot></slot>
        <div
          :class="{ 'gl-flex-direction-column-reverse': !actions.length }"
          class="gl-display-flex gl-md-display-block gl-font-size-0 gl-ml-auto gl-mt-1"
        >
          <slot name="actions">
            <actions v-if="actions.length" :tertiary-buttons="actions" />
          </slot>
        </div>
      </div>
    </template>
  </div>
</template>