Commit 843ebf7c authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'improved-changes-dropdown' into 'master'

Improved the design of the changed files dropdown

Closes #36687

See merge request gitlab-org/gitlab-ce!15367
parents 6be542bb c70289a0
...@@ -340,7 +340,8 @@ import ProjectVariables from './project_variables'; ...@@ -340,7 +340,8 @@ import ProjectVariables from './project_variables';
container: '.js-commit-pipeline-graph', container: '.js-commit-pipeline-graph',
}).bindEvents(); }).bindEvents();
initNotes(); initNotes();
initChangesDropdown(); const stickyBarPaddingTop = 16;
initChangesDropdown(document.querySelector('.navbar-gitlab').offsetHeight - stickyBarPaddingTop);
$('.commit-info.branches').load(document.querySelector('.js-commit-box').dataset.commitPath); $('.commit-info.branches').load(document.querySelector('.js-commit-box').dataset.commitPath);
break; break;
case 'projects:commit:pipelines': case 'projects:commit:pipelines':
......
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
.cgray { color: $common-gray; } .cgray { color: $common-gray; }
.clgray { color: $common-gray-light; } .clgray { color: $common-gray-light; }
.cred { color: $common-red; } .cred { color: $common-red; }
svg.cred { fill: $common-red; }
.cgreen { color: $common-green; } .cgreen { color: $common-green; }
svg.cgreen { fill: $common-green; }
.cdark { color: $common-gray-dark; } .cdark { color: $common-gray-dark; }
.text-secondary { .text-secondary {
color: $gl-text-color-secondary; color: $gl-text-color-secondary;
......
...@@ -628,21 +628,46 @@ ...@@ -628,21 +628,46 @@
} }
.diff-file-changes { .diff-file-changes {
width: 450px; max-width: 560px;
width: 100%;
z-index: 150; z-index: 150;
@media (min-width: $screen-sm-min) { @media (min-width: $screen-sm-min) {
left: $gl-padding; left: $gl-padding;
} }
a { .diff-changed-file {
display: flex;
padding-top: 8px; padding-top: 8px;
padding-bottom: 8px; padding-bottom: 8px;
min-width: 0;
} }
.diff-changed-file { .diff-file-changed-icon {
margin-top: 2px;
}
.diff-changed-file-content {
display: flex; display: flex;
align-items: center; flex-direction: column;
min-width: 0;
}
.diff-changed-file-name,
.diff-changed-file-path {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.diff-changed-file-path {
direction: rtl;
color: $gl-text-color-tertiary;
}
.diff-changed-stats {
margin-left: auto;
white-space: nowrap;
} }
} }
......
...@@ -152,11 +152,11 @@ module DiffHelper ...@@ -152,11 +152,11 @@ module DiffHelper
def diff_file_changed_icon(diff_file) def diff_file_changed_icon(diff_file)
if diff_file.deleted_file? || diff_file.renamed_file? if diff_file.deleted_file? || diff_file.renamed_file?
"minus" "file-deletion"
elsif diff_file.new_file? elsif diff_file.new_file?
"plus" "file-addition"
else else
"adjust" "file-modified"
end end
end end
......
...@@ -22,9 +22,11 @@ ...@@ -22,9 +22,11 @@
- diff_files.each do |diff_file| - diff_files.each do |diff_file|
%li %li
%a.diff-changed-file{ href: "##{hexdigest(diff_file.file_path)}", title: diff_file.new_path } %a.diff-changed-file{ href: "##{hexdigest(diff_file.file_path)}", title: diff_file.new_path }
= icon("#{diff_file_changed_icon(diff_file)} fw", class: "#{diff_file_changed_icon_color(diff_file)} append-right-5") = sprite_icon(diff_file_changed_icon(diff_file), size: 16, css_class: "#{diff_file_changed_icon_color(diff_file)} diff-file-changed-icon append-right-8")
%span.diff-file-changes-path.append-right-5= diff_file.new_path %span.diff-changed-file-content.append-right-8
.pull-right %strong.diff-changed-file-name= diff_file.blob.name
%span.diff-changed-file-path.prepend-top-5= diff_file.new_path
%span.diff-changed-stats
%span.cgreen< %span.cgreen<
+#{diff_file.added_lines} +#{diff_file.added_lines}
%span.cred< %span.cred<
......
---
title: Improved diff changed files dropdown design
merge_request:
author:
type: changed
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