Commit 99ee6fd7 authored by Phil Hughes's avatar Phil Hughes

Updated design of collapse button in widget extensions

This changes the button design to better match the designs
set out for widget extensions.
parent edaf3c46
<script> <script>
import { GlButton, GlLoadingIcon, GlLink, GlBadge, GlSafeHtmlDirective } from '@gitlab/ui'; import {
GlButton,
GlLoadingIcon,
GlLink,
GlBadge,
GlSafeHtmlDirective,
GlTooltipDirective,
} from '@gitlab/ui';
import { sprintf, s__ } from '~/locale';
import SmartVirtualList from '~/vue_shared/components/smart_virtual_list.vue'; import SmartVirtualList from '~/vue_shared/components/smart_virtual_list.vue';
import { EXTENSION_ICON_CLASS } from '../../constants'; import { EXTENSION_ICON_CLASS } from '../../constants';
import StatusIcon from './status_icon.vue'; import StatusIcon from './status_icon.vue';
...@@ -21,6 +29,7 @@ export default { ...@@ -21,6 +29,7 @@ export default {
}, },
directives: { directives: {
SafeHtml: GlSafeHtmlDirective, SafeHtml: GlSafeHtmlDirective,
GlTooltip: GlTooltipDirective,
}, },
data() { data() {
return { return {
...@@ -44,6 +53,14 @@ export default { ...@@ -44,6 +53,14 @@ export default {
return true; return true;
}, },
collapseButtonLabel() {
return sprintf(
this.isCollapsed
? s__('mrWidget|Show %{widget} details')
: s__('mrWidget|Hide %{widget} details'),
{ widget: this.$options.name },
);
},
statusIconName() { statusIconName() {
if (this.isLoadingSummary) return null; if (this.isLoadingSummary) return null;
...@@ -102,22 +119,28 @@ export default { ...@@ -102,22 +119,28 @@ export default {
:is-loading="isLoadingSummary" :is-loading="isLoadingSummary"
:icon-name="statusIconName" :icon-name="statusIconName"
/> />
<div class="media-body d-flex flex-align-self-center align-items-center"> <div class="media-body gl-display-flex gl-align-self-center gl-align-items-center">
<div class="code-text"> <div class="code-text">
<template v-if="isLoadingSummary"> <template v-if="isLoadingSummary">
{{ __('Loading...') }} {{ __('Loading...') }}
</template> </template>
<div v-else v-safe-html="summary(collapsedData)"></div> <div v-else v-safe-html="summary(collapsedData)"></div>
</div> </div>
<div
class="gl-float-right gl-align-self-center gl-border-l-1 gl-border-l-solid gl-border-gray-100 gl-ml-3 gl-pl-3"
>
<gl-button <gl-button
v-if="isCollapsible" v-if="isCollapsible"
size="small" v-gl-tooltip
class="float-right align-self-center" :title="collapseButtonLabel"
:aria-expanded="`${!isCollapsed}`"
:aria-label="collapseButtonLabel"
:icon="isCollapsed ? 'chevron-lg-down' : 'chevron-lg-up'"
category="tertiary"
data-testid="toggle-button" data-testid="toggle-button"
@click="toggleCollapsed" @click="toggleCollapsed"
> />
{{ isCollapsed ? __('Expand') : __('Collapse') }} </div>
</gl-button>
</div> </div>
</div> </div>
<div <div
...@@ -137,11 +160,9 @@ export default { ...@@ -137,11 +160,9 @@ export default {
wclass="report-block-list" wclass="report-block-list"
class="report-block-container" class="report-block-container"
> >
<li v-for="data in fullData" :key="data.id" class="d-flex align-items-center"> <li v-for="data in fullData" :key="data.id" class="gl-display-flex gl-align-items-center">
<status-icon v-if="data.icon" :icon-name="data.icon.name" :size="12" /> <status-icon v-if="data.icon" :icon-name="data.icon.name" :size="12" />
<div <div class="gl-mt-2 gl-mb-2 gl-flex-wrap gl-align-self-center gl-display-flex">
class="gl-mt-2 gl-mb-2 align-content-around align-items-start flex-wrap align-self-center d-flex"
>
<div v-safe-html="data.text" class="gl-mr-4"></div> <div v-safe-html="data.text" class="gl-mr-4"></div>
<div v-if="data.link"> <div v-if="data.link">
<gl-link :href="data.link.href">{{ data.link.text }}</gl-link> <gl-link :href="data.link.href">{{ data.link.text }}</gl-link>
......
...@@ -40504,6 +40504,9 @@ msgstr "" ...@@ -40504,6 +40504,9 @@ msgstr ""
msgid "mrWidget|Failed to load deployment statistics" msgid "mrWidget|Failed to load deployment statistics"
msgstr "" msgstr ""
msgid "mrWidget|Hide %{widget} details"
msgstr ""
msgid "mrWidget|If the %{missingBranchName} branch exists in your local repository, you can merge this merge request manually using the command line" msgid "mrWidget|If the %{missingBranchName} branch exists in your local repository, you can merge this merge request manually using the command line"
msgstr "" msgstr ""
...@@ -40626,6 +40629,9 @@ msgstr "" ...@@ -40626,6 +40629,9 @@ msgstr ""
msgid "mrWidget|Set by %{merge_author} to start a merge train when the pipeline succeeds" msgid "mrWidget|Set by %{merge_author} to start a merge train when the pipeline succeeds"
msgstr "" msgstr ""
msgid "mrWidget|Show %{widget} details"
msgstr ""
msgid "mrWidget|The changes were merged into" msgid "mrWidget|The changes were merged into"
msgstr "" msgstr ""
......
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