Skip to content

Commit c46f53a

Browse files
wxiaoguanglunnyjolheiser
authored
Fix diff UI for unexpandable items (#22700)
Follows #21094 Before: There are 2 problems: 1. Sometimes, the header starts with a number, sometimes, it starts with an icon button. It makes the UI look like misaligned. 2. The second item's bottom border is too thick (actually, that's an empty element with border, which should be hidden as well) 3. (An old problem) the number is not mono-font ![image](https://user-images.githubusercontent.com/2114189/215935944-003fe2d3-69bf-413c-bbae-0a4668a508c3.png) After: Fix above problems. ![image](https://user-images.githubusercontent.com/2114189/215944811-b867a20c-110c-47a2-aa52-572a8162a44d.png) --------- Co-authored-by: Lunny Xiao <[email protected]> Co-authored-by: John Olheiser <[email protected]>
1 parent 5d9c64b commit c46f53a

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

templates/repo/diff/box.tmpl

+10-11
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,18 @@
7676
{{$isImage := or (call $.IsBlobAnImage $blobBase) (call $.IsBlobAnImage $blobHead)}}
7777
{{$isCsv := (call $.IsCsvFile $file)}}
7878
{{$showFileViewToggle := or $isImage (and (not $file.IsIncomplete) $isCsv)}}
79-
<div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}} mt-3" id="diff-{{$file.NameHash}}" data-old-filename="{{$file.OldName}}" data-new-filename="{{$file.Name}}" {{if $file.ShouldBeHidden}}data-folded="true"{{end}}>
79+
{{$isExpandable := or (gt $file.Addition 0) (gt $file.Deletion 0) $file.IsBin}}
80+
<div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}} mt-3" id="diff-{{$file.NameHash}}" data-old-filename="{{$file.OldName}}" data-new-filename="{{$file.Name}}" {{if or ($file.ShouldBeHidden) (not $isExpandable)}}data-folded="true"{{end}}>
8081
<h4 class="diff-file-header sticky-2nd-row ui top attached normal header df ac sb">
8182
<div class="df ac">
82-
{{if or (gt $file.Addition 0) (gt $file.Deletion 0) $file.IsBin}}
83-
<a role="button" class="fold-file muted mr-2">
84-
{{if $file.ShouldBeHidden}}
85-
{{svg "octicon-chevron-right" 18}}
86-
{{else}}
87-
{{svg "octicon-chevron-down" 18}}
88-
{{end}}
89-
</a>
90-
{{end}}
91-
<div class="bold df ac">
83+
<a role="button" class="fold-file muted mr-2" {{if not $isExpandable}}style="visibility: hidden"{{end}}>
84+
{{if $file.ShouldBeHidden}}
85+
{{svg "octicon-chevron-right" 18}}
86+
{{else}}
87+
{{svg "octicon-chevron-down" 18}}
88+
{{end}}
89+
</a>
90+
<div class="bold df ac mono">
9291
{{if $file.IsBin}}
9392
<span class="ml-1 mr-3">
9493
{{$.locale.Tr "repo.diff.bin"}}

0 commit comments

Comments
 (0)