Commit f3719089 authored by Coung Ngo's avatar Coung Ngo

Improve issue sticky header code

Improved code as a result of reviewer comments
parent a1d6c24e
...@@ -15,6 +15,7 @@ import editedComponent from './edited.vue'; ...@@ -15,6 +15,7 @@ import editedComponent from './edited.vue';
import formComponent from './form.vue'; import formComponent from './form.vue';
import PinnedLinks from './pinned_links.vue'; import PinnedLinks from './pinned_links.vue';
import recaptchaModalImplementor from '~/vue_shared/mixins/recaptcha_modal_implementor'; import recaptchaModalImplementor from '~/vue_shared/mixins/recaptcha_modal_implementor';
import { IssuableStatus, IssuableStatusText, IssuableType } from '../constants';
export default { export default {
components: { components: {
...@@ -207,16 +208,16 @@ export default { ...@@ -207,16 +208,16 @@ export default {
return sprintf(s__('Error updating %{issuableType}'), { issuableType: this.issuableType }); return sprintf(s__('Error updating %{issuableType}'), { issuableType: this.issuableType });
}, },
isOpenStatus() { isOpenStatus() {
return this.issuableStatus === 'opened'; return this.issuableStatus === IssuableStatus.Open;
}, },
statusIcon() { statusIcon() {
return this.isOpenStatus ? 'issue-open-m' : 'mobile-issue-close'; return this.isOpenStatus ? 'issue-open-m' : 'mobile-issue-close';
}, },
statusText() { statusText() {
return this.isOpenStatus ? __('Open') : __('Closed'); return IssuableStatusText[this.issuableStatus];
}, },
shouldShowStickyHeader() { shouldShowStickyHeader() {
return this.isStickyHeaderShowing && this.issuableType === 'issue'; return this.isStickyHeaderShowing && this.issuableType === IssuableType.Issue;
}, },
}, },
created() { created() {
...@@ -417,7 +418,7 @@ export default { ...@@ -417,7 +418,7 @@ export default {
/> />
<gl-intersection-observer @appear="hideStickyHeader" @disappear="showStickyHeader"> <gl-intersection-observer @appear="hideStickyHeader" @disappear="showStickyHeader">
<transition name="slide"> <transition name="issuable-header-slide">
<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"
...@@ -470,15 +471,3 @@ export default { ...@@ -470,15 +471,3 @@ export default {
</div> </div>
</div> </div>
</template> </template>
<style>
.slide-enter-active,
.slide-leave-active {
transition: transform 0.5s;
}
.slide-enter,
.slide-leave-to {
transform: translateY(-100%);
}
</style>
import { __ } from '~/locale';
export const IssuableStatus = {
Open: 'opened',
Closed: 'closed',
};
export const IssuableStatusText = {
[IssuableStatus.Open]: __('Open'),
[IssuableStatus.Closed]: __('Closed'),
};
export const IssuableType = {
Issue: 'issue',
Epic: 'epic',
MergeRequest: 'merge_request',
};
...@@ -360,6 +360,16 @@ ul.related-merge-requests > li { ...@@ -360,6 +360,16 @@ ul.related-merge-requests > li {
} }
} }
.issuable-header-slide-enter-active,
.issuable-header-slide-leave-active {
transition: transform 0.5s;
}
.issuable-header-slide-enter,
.issuable-header-slide-leave-to {
transform: translateY(-100%);
}
.issuable-list-root { .issuable-list-root {
.gl-label-link { .gl-label-link {
text-decoration: none; text-decoration: none;
......
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