Commit 7a3b4eac authored by Coung Ngo's avatar Coung Ngo

Improve issue sticky header code

Improved code as a result of reviewer comments
parent f3719089
<script> <script>
import { GlIntersectionObserver } from '@gitlab/ui'; import { GlIcon, GlIntersectionObserver } from '@gitlab/ui';
import Visibility from 'visibilityjs'; import Visibility from 'visibilityjs';
import { __, s__, sprintf } from '~/locale'; import { __, s__, sprintf } from '~/locale';
import createFlash from '~/flash'; import createFlash from '~/flash';
import { visitUrl } from '~/lib/utils/url_utility'; import { visitUrl } from '~/lib/utils/url_utility';
import Poll from '~/lib/utils/poll'; import Poll from '~/lib/utils/poll';
import Icon from '~/vue_shared/components/icon.vue';
import eventHub from '../event_hub'; import eventHub from '../event_hub';
import Service from '../services/index'; import Service from '../services/index';
import Store from '../stores'; import Store from '../stores';
...@@ -19,8 +18,8 @@ import { IssuableStatus, IssuableStatusText, IssuableType } from '../constants'; ...@@ -19,8 +18,8 @@ import { IssuableStatus, IssuableStatusText, IssuableType } from '../constants';
export default { export default {
components: { components: {
GlIcon,
GlIntersectionObserver, GlIntersectionObserver,
Icon,
descriptionComponent, descriptionComponent,
titleComponent, titleComponent,
editedComponent, editedComponent,
...@@ -422,6 +421,7 @@ export default { ...@@ -422,6 +421,7 @@ export default {
<div <div
v-if="shouldShowStickyHeader" v-if="shouldShowStickyHeader"
class="issue-sticky-header gl-fixed gl-z-index-2 gl-bg-white gl-border-1 gl-border-b-solid gl-border-b-gray-200 gl-py-3" class="issue-sticky-header gl-fixed gl-z-index-2 gl-bg-white gl-border-1 gl-border-b-solid gl-border-b-gray-200 gl-py-3"
data-testid="issue-sticky-header"
> >
<div <div
class="issue-sticky-header-text gl-display-flex gl-align-items-center gl-mx-auto gl-px-5" class="issue-sticky-header-text gl-display-flex gl-align-items-center gl-mx-auto gl-px-5"
...@@ -430,7 +430,7 @@ export default { ...@@ -430,7 +430,7 @@ export default {
class="issuable-status-box status-box gl-my-0" class="issuable-status-box status-box gl-my-0"
:class="[isOpenStatus ? 'status-box-open' : 'status-box-issue-closed']" :class="[isOpenStatus ? 'status-box-open' : 'status-box-issue-closed']"
> >
<icon :name="statusIcon" class="gl-display-block d-sm-none gl-h-6!" /> <gl-icon :name="statusIcon" class="gl-display-block d-sm-none gl-h-6!" />
<span class="gl-display-none d-sm-block">{{ statusText }}</span> <span class="gl-display-none d-sm-block">{{ statusText }}</span>
</p> </p>
<p <p
......
...@@ -305,9 +305,9 @@ ul.related-merge-requests > li { ...@@ -305,9 +305,9 @@ ul.related-merge-requests > li {
} }
.issue-sticky-header { .issue-sticky-header {
left: 0; @include gl-left-0;
@include gl-w-full;
top: $header-height; top: $header-height;
width: 100%;
// collapsed right sidebar // collapsed right sidebar
@include media-breakpoint-up(sm) { @include media-breakpoint-up(sm) {
...@@ -362,7 +362,7 @@ ul.related-merge-requests > li { ...@@ -362,7 +362,7 @@ ul.related-merge-requests > li {
.issuable-header-slide-enter-active, .issuable-header-slide-enter-active,
.issuable-header-slide-leave-active { .issuable-header-slide-leave-active {
transition: transform 0.5s; @include gl-transition-slow;
} }
.issuable-header-slide-enter, .issuable-header-slide-enter,
......
...@@ -26,7 +26,7 @@ describe('Issuable output', () => { ...@@ -26,7 +26,7 @@ describe('Issuable output', () => {
let realtimeRequestCount = 0; let realtimeRequestCount = 0;
let wrapper; let wrapper;
const findStickyHeader = () => wrapper.find('.issue-sticky-header'); const findStickyHeader = () => wrapper.find('[data-testid="issue-sticky-header"]');
beforeEach(() => { beforeEach(() => {
setFixtures(` setFixtures(`
......
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