Commit 283772d0 authored by Phil Hughes's avatar Phil Hughes

Improve responsiveness of notes header content

Closes https://gitlab.com/gitlab-org/gitlab/-/issues/214732
parent 8a2e578e
......@@ -47,6 +47,11 @@ export default {
required: false,
default: '',
},
isOverviewTab: {
type: Boolean,
required: false,
default: false,
},
},
computed: {
...mapGetters(['userCanReply']),
......@@ -127,6 +132,7 @@ export default {
:show-reply-button="userCanReply"
:discussion-root="true"
:discussion-resolve-path="discussion.resolve_path"
:is-overview-tab="isOverviewTab"
@handleDeleteNote="$emit('deleteNote')"
@startReplying="$emit('startReplying')"
>
......@@ -176,6 +182,7 @@ export default {
:line="diffLine"
:discussion-root="index === 0"
:discussion-resolve-path="discussion.resolve_path"
:is-overview-tab="isOverviewTab"
@handleDeleteNote="$emit('deleteNote')"
>
<template #avatar-badge>
......
......@@ -66,6 +66,11 @@ export default {
required: false,
default: '',
},
isOverviewTab: {
type: Boolean,
required: false,
default: false,
},
},
data() {
return {
......@@ -263,6 +268,7 @@ export default {
:is-expanded="isExpanded"
:line="line"
:should-group-replies="shouldGroupReplies"
:is-overview-tab="isOverviewTab"
@startReplying="showReplyForm"
@deleteNote="deleteNoteHandler"
>
......
......@@ -84,6 +84,11 @@ export default {
required: false,
default: '',
},
isOverviewTab: {
type: Boolean,
required: false,
default: false,
},
},
data() {
return {
......@@ -186,6 +191,14 @@ export default {
return fileResolvedFromAvailableSource || null;
},
avatarSize() {
// Use a different size if shown on a Merge Request Diff
if (this.line && !this.isOverviewTab) {
return 24;
}
return 40;
},
},
created() {
const line = this.note.position?.line_range?.start || this.line;
......@@ -391,7 +404,7 @@ export default {
:link-href="author.path"
:img-src="author.avatar_url"
:img-alt="author.name"
:img-size="40"
:img-size="avatarSize"
lazy
>
<template #avatar-badge>
......
......@@ -317,6 +317,7 @@ export default {
:key="discussion.id"
:discussion="discussion"
:render-diff-file="true"
is-overview-tab
:help-page-path="helpPagePath"
/>
</template>
......
......@@ -34,12 +34,23 @@ export default {
type: Object,
required: true,
},
line: {
type: Object,
required: false,
default: null,
},
},
computed: {
...mapGetters(['getUserData']),
renderedNote() {
return renderMarkdown(this.note.body);
},
avatarSize() {
if (this.line) {
return 16;
}
return 40;
},
},
};
</script>
......@@ -50,7 +61,7 @@ export default {
<user-avatar-link
:link-href="getUserData.path"
:img-src="getUserData.avatar_url"
:img-size="40"
:img-size="avatarSize"
/>
</div>
<div ref="note" :class="{ discussion: !note.individual_note }" class="timeline-content">
......
......@@ -1034,6 +1034,27 @@ table.code {
}
}
// Notes tweaks for the Changes tab ONLY
.diff-tr {
.timeline-discussion-body {
clear: left;
.note-body {
margin-top: 0 !important;
}
}
.timeline-entry img.avatar {
margin-top: -2px;
margin-right: $gl-padding-8;
}
// tiny adjustment to vertical align with the note header text
.discussion-collapsible .timeline-icon {
padding-top: 2px;
}
}
.files:not([data-can-create-note]) .frame {
cursor: auto;
}
......@@ -1152,7 +1173,7 @@ table.code {
}
.discussion-collapsible {
margin: 0 $gl-padding $gl-padding 71px;
margin: 0 $gl-padding $gl-padding;
.notes {
border-radius: $border-radius-default;
......
......@@ -125,18 +125,17 @@ $system-note-svg-size: 16px;
}
}
.timeline-discussion-body {
margin-top: -$gl-padding-8;
}
.discussion {
display: block;
position: relative;
.timeline-discussion-body {
margin-top: -$gl-padding-8;
overflow-x: auto;
overflow-y: hidden;
.note-body {
margin-top: $gl-padding-8;
}
}
.diff-content {
......@@ -586,17 +585,47 @@ $system-note-svg-size: 16px;
.note-header {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
> .note-header-info,
> .note-actions {
flex-grow: 1;
flex-shrink: 1;
}
}
.note {
@include notes-media('max', map-get($grid-breakpoints, sm) - 1) {
.note-header {
.note-actions {
flex-wrap: wrap;
margin-bottom: $gl-padding-12;
> :first-child {
margin-left: 0;
}
}
}
.note-header-author-name {
display: block;
}
}
}
.note-header-info {
min-width: 0;
padding-bottom: $gl-padding-8;
&.discussion {
padding-bottom: 0;
}
}
.note-header-info,
.note-actions {
padding-bottom: $gl-padding-8;
}
.system-note .note-header-info {
padding-bottom: 0;
}
......@@ -667,7 +696,8 @@ $system-note-svg-size: 16px;
.note-actions {
align-self: flex-start;
flex-shrink: 0;
justify-content: flex-end;
flex-shrink: 1;
display: inline-flex;
align-items: center;
margin-left: 10px;
......
......@@ -189,6 +189,27 @@ describe('issue_note', () => {
createWrapper();
});
describe('avatar sizes in diffs', () => {
const line = {
line_code: 'abc_1_1',
type: null,
old_line: '1',
new_line: '1',
};
it('should render 24px avatars', async () => {
wrapper.setProps({
note: { ...note },
discussionRoot: true,
line,
});
await wrapper.vm.$nextTick();
expect(wrapper.findComponent(UserAvatarLink).props('imgSize')).toBe(24);
});
});
it('should render user information', () => {
const { author } = note;
const avatar = wrapper.findComponent(UserAvatarLink);
......
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