Commit 8a91966d authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Addressing minor review comments

Cleaning up imported components and
ensuring we use gl-* components

Replace button with gl-button

Replace tooltip directive with component
parent c4d1c846
<script> <script>
import { GlButton, GlTooltipDirective } from '@gitlab/ui'; import { GlButton, GlIcon, GlTooltip } from '@gitlab/ui';
import { approximateDuration } from '~/lib/utils/datetime_utility'; import { approximateDuration } from '~/lib/utils/datetime_utility';
import Icon from '~/vue_shared/components/icon.vue';
import StageCardListItem from './stage_card_list_item.vue'; import StageCardListItem from './stage_card_list_item.vue';
export default { export default {
name: 'StageNavItem', name: 'StageNavItem',
components: { components: {
StageCardListItem, StageCardListItem,
Icon, GlIcon,
GlButton, GlButton,
}, GlTooltip,
directives: {
GlTooltip: GlTooltipDirective,
}, },
props: { props: {
isDefaultStage: { isDefaultStage: {
...@@ -83,7 +80,7 @@ export default { ...@@ -83,7 +80,7 @@ export default {
checkIfTitleOverflows() { checkIfTitleOverflows() {
const [titleEl] = this.$refs.title?.children; const [titleEl] = this.$refs.title?.children;
if (titleEl) { if (titleEl) {
this.isTitleOverflowing = titleEl.offsetWidth > this.$refs.title.offsetWidth; this.isTitleOverflowing = titleEl.scrollWidth > this.$refs.title.offsetWidth;
} }
}, },
}, },
...@@ -102,8 +99,10 @@ export default { ...@@ -102,8 +99,10 @@ export default {
class="stage-nav-item-cell stage-name text-truncate w-50 pr-2" class="stage-nav-item-cell stage-name text-truncate w-50 pr-2"
:class="{ 'font-weight-bold': isActive }" :class="{ 'font-weight-bold': isActive }"
> >
<span v-if="isTitleOverflowing" v-gl-tooltip.hover :title="title">{{ title }}</span> <gl-tooltip v-if="isTitleOverflowing" :target="() => $refs.titleSpan">
<span v-else>{{ title }}</span> {{ title }}
</gl-tooltip>
<span ref="titleSpan">{{ title }}</span>
</div> </div>
<div class="stage-nav-item-cell w-50 d-flex justify-content-between"> <div class="stage-nav-item-cell w-50 d-flex justify-content-between">
<div ref="median" class="stage-median w-75 align-items-start"> <div ref="median" class="stage-median w-75 align-items-start">
...@@ -116,38 +115,26 @@ export default { ...@@ -116,38 +115,26 @@ export default {
class="more-actions-toggle btn btn-transparent p-0" class="more-actions-toggle btn btn-transparent p-0"
data-toggle="dropdown" data-toggle="dropdown"
> >
<icon class="icon" name="ellipsis_v" /> <gl-icon class="icon" name="ellipsis_v" />
</gl-button> </gl-button>
<ul class="more-actions-dropdown dropdown-menu dropdown-open-left"> <ul class="more-actions-dropdown dropdown-menu dropdown-open-left">
<template v-if="isDefaultStage"> <template v-if="isDefaultStage">
<li> <li>
<button <gl-button @click="handleDropdownAction('hide', $event)">
type="button"
class="btn-default btn-transparent"
@click="handleDropdownAction('hide', $event)"
>
{{ __('Hide stage') }} {{ __('Hide stage') }}
</button> </gl-button>
</li> </li>
</template> </template>
<template v-else> <template v-else>
<li> <li>
<button <gl-button @click="handleDropdownAction('edit', $event)">
type="button"
class="btn-default btn-transparent"
@click="handleDropdownAction('edit', $event)"
>
{{ __('Edit stage') }} {{ __('Edit stage') }}
</button> </gl-button>
</li> </li>
<li> <li>
<button <gl-button @click="handleDropdownAction('remove', $event)">
type="button"
class="btn-danger danger"
@click="handleDropdownAction('remove', $event)"
>
{{ __('Remove stage') }} {{ __('Remove stage') }}
</button> </gl-button>
</li> </li>
</template> </template>
</ul> </ul>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment