Commit 789b7cc0 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'improve-related-issues-card-style' into 'master'

Minor style tweaks to Related Issues header

See merge request gitlab-org/gitlab!37396
parents a8c3cc80 0ebe8e2a
<script> <script>
import { GlLink, GlIcon } from '@gitlab/ui'; import { GlLink, GlIcon, GlButton } from '@gitlab/ui';
import Icon from '~/vue_shared/components/icon.vue';
import AddIssuableForm from './add_issuable_form.vue'; import AddIssuableForm from './add_issuable_form.vue';
import RelatedIssuesList from './related_issues_list.vue'; import RelatedIssuesList from './related_issues_list.vue';
import { import {
...@@ -13,8 +12,8 @@ import { ...@@ -13,8 +12,8 @@ import {
export default { export default {
name: 'RelatedIssuesBlock', name: 'RelatedIssuesBlock',
components: { components: {
Icon,
GlLink, GlLink,
GlButton,
GlIcon, GlIcon,
AddIssuableForm, AddIssuableForm,
RelatedIssuesList, RelatedIssuesList,
...@@ -125,44 +124,44 @@ export default { ...@@ -125,44 +124,44 @@ export default {
<template> <template>
<div id="related-issues" class="related-issues-block"> <div id="related-issues" class="related-issues-block">
<div class="card card-slim"> <div class="card card-slim gl-overflow-hidden">
<div :class="{ 'panel-empty-heading border-bottom-0': !hasBody }" class="card-header"> <div :class="{ 'panel-empty-heading border-bottom-0': !hasBody }" class="card-header">
<h3 class="card-title mt-0 mb-0 h5 position-relative"> <h3
class="card-title h5 position-relative gl-my-0 gl-display-flex gl-align-items-center gl-h-7"
>
<gl-link <gl-link
id="user-content-related-issues" id="user-content-related-issues"
class="anchor position-absolute text-decoration-none" class="anchor position-absolute gl-text-decoration-none"
href="#related-issues" href="#related-issues"
aria-hidden="true" aria-hidden="true"
/> />
<slot name="headerText">{{ __('Linked issues') }}</slot> <slot name="headerText">{{ __('Linked issues') }}</slot>
<a v-if="hasHelpPath" :href="helpPath"> <gl-link
<i v-if="hasHelpPath"
class="related-issues-header-help-icon fa fa-question-circle" :href="helpPath"
:aria-label="__('Read more about related issues')" target="_blank"
></i> class="gl-display-flex gl-align-items-center gl-ml-2 gl-text-gray-700"
</a> :aria-label="__('Read more about related issues')"
<div class="d-inline-flex lh-100 align-middle"> >
<div <gl-icon name="question" :size="12" role="text" />
class="js-related-issues-header-issue-count related-issues-header-issue-count issue-count-badge gl-display-inline-flex gl-mx-2" </gl-link>
>
<span class="issue-count-badge-count"> <div class="gl-display-inline-flex">
<icon :name="issuableTypeIcon" class="mr-1 text-secondary" /> <div class="js-related-issues-header-issue-count gl-display-inline-flex gl-mx-5">
<span class="gl-display-inline-flex gl-align-items-center">
<gl-icon :name="issuableTypeIcon" class="gl-mr-2 gl-text-gray-700" />
{{ badgeLabel }} {{ badgeLabel }}
</span> </span>
</div> </div>
<button <gl-button
v-if="canAdmin" v-if="canAdmin"
ref="issueCountBadgeAddButton"
type="button"
:class="qaClass"
class="js-issue-count-badge-add-button issue-count-badge-add-button btn btn-sm btn-default"
:aria-label="__('Add an issue')"
data-placement="top"
data-qa-selector="related_issues_plus_button" data-qa-selector="related_issues_plus_button"
icon="plus"
:aria-label="__('Add a related issue')"
:class="qaClass"
class="js-issue-count-badge-add-button"
@click="$emit('toggleAddRelatedIssuesForm', $event)" @click="$emit('toggleAddRelatedIssuesForm', $event)"
> />
<gl-icon name="plus" aria-hidden="true" />
</button>
</div> </div>
</h3> </h3>
</div> </div>
......
...@@ -9,10 +9,6 @@ $token-spacing-bottom: 0.5em; ...@@ -9,10 +9,6 @@ $token-spacing-bottom: 0.5em;
color: $gl-text-color-secondary; color: $gl-text-color-secondary;
} }
.related-issues-header-issue-count {
margin-left: 0.5em;
}
.related-issues-token-body { .related-issues-token-body {
padding: 0; padding: 0;
......
---
title: Minor style fixes to 'Linked Issues' card
merge_request: 37396
author:
type: fixed
import { shallowMount, mount } from '@vue/test-utils'; import { shallowMount, mount } from '@vue/test-utils';
import { GlButton, GlIcon } from '@gitlab/ui';
import RelatedIssuesBlock from 'ee/related_issues/components/related_issues_block.vue'; import RelatedIssuesBlock from 'ee/related_issues/components/related_issues_block.vue';
import { import {
issuable1, issuable1,
...@@ -14,6 +15,8 @@ import { ...@@ -14,6 +15,8 @@ import {
describe('RelatedIssuesBlock', () => { describe('RelatedIssuesBlock', () => {
let wrapper; let wrapper;
const findIssueCountBadgeAddButton = () => wrapper.find(GlButton);
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
}); });
...@@ -33,7 +36,7 @@ describe('RelatedIssuesBlock', () => { ...@@ -33,7 +36,7 @@ describe('RelatedIssuesBlock', () => {
}); });
it('unable to add new related issues', () => { it('unable to add new related issues', () => {
expect(wrapper.vm.$refs.issueCountBadgeAddButton).toBeUndefined(); expect(findIssueCountBadgeAddButton().exists()).toBe(false);
}); });
it('add related issues form is hidden', () => { it('add related issues form is hidden', () => {
...@@ -85,7 +88,7 @@ describe('RelatedIssuesBlock', () => { ...@@ -85,7 +88,7 @@ describe('RelatedIssuesBlock', () => {
}); });
it('can add new related issues', () => { it('can add new related issues', () => {
expect(wrapper.vm.$refs.issueCountBadgeAddButton).toBeDefined(); expect(findIssueCountBadgeAddButton().exists()).toBe(true);
}); });
}); });
...@@ -171,14 +174,16 @@ describe('RelatedIssuesBlock', () => { ...@@ -171,14 +174,16 @@ describe('RelatedIssuesBlock', () => {
}, },
].forEach(({ issuableType, icon }) => { ].forEach(({ issuableType, icon }) => {
it(`issuableType=${issuableType} is passed`, () => { it(`issuableType=${issuableType} is passed`, () => {
wrapper = mount(RelatedIssuesBlock, { wrapper = shallowMount(RelatedIssuesBlock, {
propsData: { propsData: {
pathIdSeparator: PathIdSeparator.Issue, pathIdSeparator: PathIdSeparator.Issue,
issuableType, issuableType,
}, },
}); });
expect(wrapper.contains(`.issue-count-badge-count .ic-${icon}`)).toBe(true); const iconComponent = wrapper.find(GlIcon);
expect(iconComponent.exists()).toBe(true);
expect(iconComponent.props('name')).toBe(icon);
}); });
}); });
}); });
......
...@@ -1429,6 +1429,9 @@ msgstr "" ...@@ -1429,6 +1429,9 @@ msgstr ""
msgid "Add a numbered list" msgid "Add a numbered list"
msgstr "" msgstr ""
msgid "Add a related issue"
msgstr ""
msgid "Add a table" msgid "Add a table"
msgstr "" msgstr ""
...@@ -1447,9 +1450,6 @@ msgstr "" ...@@ -1447,9 +1450,6 @@ msgstr ""
msgid "Add an impersonation token" msgid "Add an impersonation token"
msgstr "" msgstr ""
msgid "Add an issue"
msgstr ""
msgid "Add another link" msgid "Add another link"
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