Skip to content

Commit daf6284

Browse files
Fix sticky diff stats container (#12002)
* Fix sticky diff stats container * Use pure CSS sticky instead of Fomantic's JS * add border color to arc-green * add slight padding on sides * make linter happy Co-authored-by: techknowlogick <[email protected]>
1 parent fc2f2c7 commit daf6284

File tree

5 files changed

+18
-8
lines changed

5 files changed

+18
-8
lines changed

semantic.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
"segment",
5353
"sidebar",
5454
"site",
55-
"sticky",
5655
"tab",
5756
"table",
5857
"text",

templates/repo/diff/box.tmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{if .DiffNotAvailable}}
2-
<div class="diff-detail-box diff-box ui sticky">
2+
<div class="diff-detail-box diff-box sticky">
33
<div>
44
<div class="ui right">
55
{{if .PageIsPullFiles}}
@@ -17,7 +17,7 @@
1717
<h4>{{.i18n.Tr "repo.diff.data_not_available"}}</h4>
1818
{{else}}
1919
<div>
20-
<div class="diff-detail-box diff-box ui sticky">
20+
<div class="diff-detail-box diff-box sticky">
2121
<i class="fa fa-retweet"></i>
2222
{{.i18n.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}}
2323
<div class="ui right">
@@ -192,15 +192,15 @@
192192
<td class="add-comment-right">
193193
{{if and $resolved (eq $line.GetCommentSide "proposed")}}
194194
<div class="ui top attached header">
195-
<span class="ui grey text left"><b>{{$resolveDoer.Name}}</b> {{$.i18n.Tr "repo.issues.review.resolved_by"}}</span>
195+
<span class="ui grey text left"><b>{{$resolveDoer.Name}}</b> {{$.i18n.Tr "repo.issues.review.resolved_by"}}</span>
196196
<button id="show-outdated-{{(index $line.Comments 0).ID}}" data-comment="{{(index $line.Comments 0).ID}}" class="ui compact right labeled button show-outdated">
197197
{{svg "octicon-unfold" 16}}
198198
{{$.i18n.Tr "repo.issues.review.show_resolved"}}
199199
</button>
200200
<button id="hide-outdated-{{(index $line.Comments 0).ID}}" data-comment="{{(index $line.Comments 0).ID}}" class="hide ui compact right labeled button hide-outdated">
201201
{{svg "octicon-fold" 16}}
202202
{{$.i18n.Tr "repo.issues.review.hide_resolved"}}
203-
</button>
203+
</button>
204204
</div>
205205
{{end}}
206206
{{if eq $line.GetCommentSide "proposed"}}

web_src/js/index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,8 +1204,6 @@ function initPullRequestReview() {
12041204
return;
12051205
}
12061206

1207-
$('.diff-detail-box.ui.sticky').sticky();
1208-
12091207
$('.btn-review').on('click', function (e) {
12101208
e.preventDefault();
12111209
$(this).closest('.dropdown').find('.menu').toggle('visible');
@@ -2042,7 +2040,6 @@ function initCodeView() {
20422040
$.get(`${$blob.data('url')}?${$blob.data('query')}&anchor=${$blob.data('anchor')}`, (blob) => {
20432041
$row.replaceWith(blob);
20442042
$(`[data-anchor="${$blob.data('anchor')}"]`).on('click', (e) => { insertBlobExcerpt(e) });
2045-
$('.diff-detail-box.ui.sticky').sticky();
20462043
});
20472044
}
20482045
$('.ui.blob-excerpt').on('click', (e) => { insertBlobExcerpt(e) });

web_src/less/_repository.less

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,6 +1567,16 @@
15671567
background: #ffffff;
15681568
line-height: 30px;
15691569

1570+
&.sticky {
1571+
position: sticky;
1572+
top: 0;
1573+
z-index: 800;
1574+
margin-bottom: 10px;
1575+
border-bottom: 1px solid #d4d4d5;
1576+
padding-left: 5px;
1577+
padding-right: 5px;
1578+
}
1579+
15701580
> div:after {
15711581
clear: both;
15721582
content: "";

web_src/less/themes/theme-arc-green.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,6 +1335,10 @@ a.ui.labels .label:hover {
13351335
.detail-files {
13361336
background-color: inherit;
13371337
}
1338+
1339+
&.sticky {
1340+
border-bottom-color: rgba(255, 255, 255, .1);
1341+
}
13381342
}
13391343

13401344
.comment-code-cloud {

0 commit comments

Comments
 (0)