Skip to content

Commit 8af9df0

Browse files
silverwind6543
andauthored
Diff and code review refactors and improvements (#13922)
* Diff CSS refactors and misc tweaks - Simplify Diff CSS styling - Add color variables for diff - Fix vertical centering of inline comment button - Slightly adjust text colors, e.g. in comment header * Code review improvments * selector tweak * fix diff issues, add inactive bg color Co-authored-by: 6543 <6543@obermui.de>
1 parent a8fa380 commit 8af9df0

File tree

5 files changed

+124
-278
lines changed

5 files changed

+124
-278
lines changed

templates/repo/issue/view_content/comments.tmpl

+4-7
Original file line numberDiff line numberDiff line change
@@ -398,10 +398,7 @@
398398
{{avatar .Poster}}
399399
</a>
400400
{{end}}
401-
<span class="badge {{if eq .Review.Type 1}}bg-green
402-
{{- else if eq .Review.Type 2}}bg-grey
403-
{{- else if eq .Review.Type 3}}bg-red
404-
{{- else}}bg-grey{{end}} text-white">{{svg (printf "octicon-%s" .Review.Type.Icon)}}</span>
401+
<span class="badge{{if eq .Review.Type 1}} bg-green text-white{{else if eq .Review.Type 3}} bg-red text-white{{end}}">{{svg (printf "octicon-%s" .Review.Type.Icon)}}</span>
405402
<span class="text grey">
406403
{{if .OriginalAuthor }}
407404
<span class="text black"><i class="fa {{MigrationIcon $.Repository.GetOriginalURLHostname}}" aria-hidden="true"></i> {{ .OriginalAuthor }}</span><span class="text grey"> {{if $.Repository.OriginalURL}}</span><span class="text migrate">({{$.i18n.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname | Safe }}){{end}}</span>
@@ -452,7 +449,7 @@
452449
{{ range $filename, $lines := .Review.CodeComments}}
453450
{{range $line, $comms := $lines}}
454451
<div class="ui segments">
455-
<div class="ui segment">
452+
<div class="ui segment py-3">
456453
{{$invalid := (index $comms 0).Invalidated}}
457454
{{$resolved := (index $comms 0).IsResolved}}
458455
{{$resolveDoer := (index $comms 0).ResolveDoer}}
@@ -497,8 +494,8 @@
497494
</div>
498495
</div>
499496
{{end}}
500-
<div id="code-comments-{{(index $comms 0).ID}}" class="ui segment{{if $resolved}} hide{{end}}">
501-
<div class="ui comments">
497+
<div id="code-comments-{{(index $comms 0).ID}}" class="ui segment{{if $resolved}} hide{{end}} py-3">
498+
<div class="ui comments mb-0">
502499
{{range $comms}}
503500
{{ $createdSubStr:= TimeSinceUnix .CreatedUnix $.Lang }}
504501
<div class="comment code-comment" id="{{.HashTag}}">

web_src/less/_base.less

+48-5
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,16 @@
7373
--color-black: #1b1c1d;
7474
--color-gold: #a1882b;
7575
--color-white: #ffffff;
76+
--color-diff-removed-word-bg: #fdb8c0;
77+
--color-diff-added-word-bg: #acf2bd;
78+
--color-diff-removed-row-bg: #ffeef0;
79+
--color-diff-added-row-bg: #e6ffed;
80+
--color-diff-removed-row-border: #f1c0c0;
81+
--color-diff-added-row-border: #e6ffed;
82+
--color-diff-inactive: #f2f2f2;
7683
/* target-based colors */
7784
--color-body: #ffffff;
85+
--color-text-dark: #080808;
7886
--color-text: #212121;
7987
--color-text-light: #555555;
8088
--color-text-light-2: #888888;
@@ -267,6 +275,10 @@ a.muted:hover,
267275
color: var(--color-text);
268276
}
269277

278+
.ui.menu .item > .label {
279+
background: var(--color-grey);
280+
}
281+
270282
.ui.link.menu .item:hover,
271283
.ui.menu .dropdown.item:hover,
272284
.ui.menu .link.item:hover,
@@ -436,6 +448,28 @@ a.ui.card:hover,
436448
background: var(--color-card);
437449
}
438450

451+
.ui.comments .comment .text,
452+
.ui.comments .comment .author {
453+
color: var(--color-text);
454+
}
455+
456+
.ui.comments .comment a.author:hover {
457+
color: var(--color-primary);
458+
}
459+
460+
.ui.comments .comment .metadata {
461+
color: var(--color-text-light-2);
462+
}
463+
464+
.ui.comments .comment .actions a {
465+
color: var(--color-text-light);
466+
}
467+
468+
.ui.comments .comment .actions a.active,
469+
.ui.comments .comment .actions a:hover {
470+
color: var(--color-primary);
471+
}
472+
439473
.ui.progress[data-percent="0"] .bar .progress {
440474
color: var(--color-text);
441475
}
@@ -714,15 +748,15 @@ a.ui.card:hover,
714748
color: var(--color-text);
715749

716750
&:hover {
717-
color: #000000;
751+
color: var(--color-text-dark);
718752
}
719753
}
720754

721755
&.grey {
722756
color: var(--color-text-light) !important;
723757

724758
a {
725-
color: inherit !important;
759+
color: var(--color-text) !important;
726760

727761
&:hover {
728762
color: var(--color-primary) !important;
@@ -731,7 +765,7 @@ a.ui.card:hover,
731765
}
732766

733767
&.light.grey {
734-
color: var(--color-grey) !important;
768+
color: var(--color-text-light-2) !important;
735769
}
736770

737771
&.green {
@@ -1691,6 +1725,10 @@ a.ui.basic.label:hover {
16911725
border-color: var(--color-secondary);
16921726
}
16931727

1728+
.ui.segments > .segment {
1729+
border-color: var(--color-secondary);
1730+
}
1731+
16941732
.ui.secondary.segment {
16951733
background: var(--color-secondary-bg);
16961734
color: var(--color-text-light);
@@ -1863,7 +1901,7 @@ table th[data-sortt-desc] {
18631901

18641902
.ui.tabular.menu .item {
18651903
padding: 11px 12px;
1866-
color: var(--color-secondary-dark-6);
1904+
color: var(--color-text-light-2);
18671905
}
18681906

18691907
.ui.tabular.menu .item:hover {
@@ -1878,12 +1916,17 @@ table th[data-sortt-desc] {
18781916
margin-top: 1px; /* offset fomantic's margin-bottom: -1px */
18791917
}
18801918

1919+
.ui.segment .ui.tabular.menu .active.item,
1920+
.ui.segment .ui.tabular.menu .active.item:hover {
1921+
background: var(--color-box-body);
1922+
}
1923+
18811924
.ui.secondary.pointing.menu {
18821925
border-color: var(--color-secondary);
18831926
}
18841927

18851928
.ui.secondary.pointing.menu .item {
1886-
color: var(--color-secondary-dark-6);
1929+
color: var(--color-text-light-2);
18871930
}
18881931

18891932
.ui.secondary.pointing.menu .active.item,

0 commit comments

Comments
 (0)