Skip to content

Make fileheader sticky in diffs #14616

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Feb 11, 2021
2 changes: 1 addition & 1 deletion templates/repo/diff/box.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
</div>
{{else}}
<div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}}" id="diff-{{.Index}}">
<h4 class="diff-file-header ui top attached normal header df ac sb">
<h4 class="diff-file-header sticky-2nd-row ui top attached normal header df ac sb">
<div class="df ac">
{{$isImage := false}}
{{if $file.IsDeleted}}
Expand Down
4 changes: 4 additions & 0 deletions web_src/less/_base.less
Original file line number Diff line number Diff line change
Expand Up @@ -1830,6 +1830,10 @@ table th[data-sortt-desc] {
.ui.button.dropdown > .dropdown.icon,
.btn-review > .dropdown.icon {
float: right !important;

@media (max-width: 480px) {
display: none;
}
}
.ui.selection.dropdown > .search.icon,
.ui.selection.dropdown > .delete.icon,
Expand Down
50 changes: 50 additions & 0 deletions web_src/less/_repository.less
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,10 @@
align-items: flex-start;
}

@media (max-width: 480px) {
flex-wrap: wrap;
}

&.sticky {
position: sticky;
top: 0;
Expand All @@ -1473,6 +1477,17 @@
margin-right: .25rem;
}

.diff-detail-stats {
@media (max-width: 480px) {
font-size: 0;
line-height: 1.6rem;

strong {
font-size: 1rem;
}
}
}

.diff-detail-actions > * {
margin-right: 0;
}
Expand All @@ -1481,6 +1496,21 @@
margin-left: .25rem;
}

.diff-detail-actions {
@media (max-width: 480px) {
padding-top: .25rem;

.ui.button {
padding-left: .5rem;
padding-right: .5rem;
display: flex;
flex-wrap: wrap;
justify-content: center;
text-align: center;
}
}
}

span.status {
display: inline-block;
width: 12px;
Expand Down Expand Up @@ -2996,6 +3026,26 @@ td.blob-excerpt {
margin-left: .5rem !important;
}

.ui.attached.header.diff-file-header {
&.sticky-2nd-row {
position: sticky;
top: 46px;
z-index: 7;

@media @mediaMd {
top: 77px;
}

@media @mediaSm {
top: 77px;
}

@media (max-width: 480px) {
position: static;
}
}
}

.diff-stats-bar {
display: inline-block;
background-color: var(--color-red);
Expand Down
2 changes: 1 addition & 1 deletion web_src/less/_review.less
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
display: inline-block;
margin: 5px 0;
font-size: 12px;
color: rgba(0, 0, 0, .6);
color: var(--color-text-light);
}

.ui.right.floated {
Expand Down