summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/vue_merge_request_widget/components/states/commit_message_dropdown.vue
blob: b6722de5277bd148c9f939221c6f68ea7751356d (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
<script>
import { GlDropdown, GlDropdownItem } from '@gitlab/ui';

export default {
  components: {
    GlDropdown,
    GlDropdownItem,
  },
  props: {
    commits: {
      type: Array,
      required: true,
      default: () => [],
    },
  },
};
</script>

<template>
  <div>
    <gl-dropdown
      right
      text="Use an existing commit message"
      variant="link"
      class="mr-commit-dropdown"
    >
      <gl-dropdown-item
        v-for="commit in commits"
        :key="commit.short_id"
        class="text-nowrap text-truncate"
        @click="$emit('input', commit.message)"
      >
        <span class="monospace mr-2">{{ commit.short_id }}</span> {{ commit.title }}
      </gl-dropdown-item>
    </gl-dropdown>
  </div>
</template>