debian-mirror-gitlab/app/assets/javascripts/vue_shared/components/dropdown/dropdown_button.vue

47 lines
1 KiB
Vue
Raw Normal View History

2018-11-08 19:23:39 +05:30
<script>
import { __ } from '~/locale';
2019-02-15 15:39:39 +05:30
import { GlLoadingIcon } from '@gitlab/ui';
2018-11-08 19:23:39 +05:30
export default {
2018-12-13 13:39:08 +05:30
components: {
GlLoadingIcon,
},
2018-11-08 19:23:39 +05:30
props: {
isDisabled: {
type: Boolean,
required: false,
default: false,
},
isLoading: {
type: Boolean,
required: false,
default: false,
},
toggleText: {
type: String,
required: false,
default: __('Select'),
},
},
};
</script>
<template>
<button
:disabled="isDisabled || isLoading"
class="dropdown-menu-toggle dropdown-menu-full-width"
type="button"
data-toggle="dropdown"
aria-expanded="false"
>
2019-02-15 15:39:39 +05:30
<gl-loading-icon v-show="isLoading" :inline="true" />
2018-11-18 11:00:15 +05:30
<template>
2019-02-15 15:39:39 +05:30
<slot v-if="$slots.default"></slot>
<span v-else class="dropdown-toggle-text"> {{ toggleText }} </span>
2018-11-18 11:00:15 +05:30
</template>
2019-02-15 15:39:39 +05:30
<span v-show="!isLoading" class="dropdown-toggle-icon">
<i class="fa fa-chevron-down" aria-hidden="true" data-hidden="true"></i>
2018-11-08 19:23:39 +05:30
</span>
</button>
</template>