Skip to content

Commit dcbf6c2

Browse files
Optimize Layout Styles of Filelist (#33920)
Align items --------- Co-authored-by: wxiaoguang <[email protected]>
1 parent 1b4adc0 commit dcbf6c2

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

templates/repo/view_list.tmpl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,21 @@
1414
{{$entry := $item.Entry}}
1515
{{$commit := $item.Commit}}
1616
{{$submoduleFile := $item.SubmoduleFile}}
17-
<div class="repo-file-cell name {{if not $commit}}notready{{end}}">
17+
<div class="repo-file-cell name muted-links {{if not $commit}}notready{{end}}">
1818
{{ctx.RenderUtils.RenderFileIcon $entry}}
1919
{{if $entry.IsSubModule}}
2020
{{$submoduleLink := $submoduleFile.SubmoduleWebLink ctx}}
2121
{{if $submoduleLink}}
22-
<a class="muted" href="{{$submoduleLink.RepoWebLink}}">{{$entry.Name}}</a> <span class="at">@</span> <a href="{{$submoduleLink.CommitWebLink}}">{{ShortSha $submoduleFile.RefID}}</a>
22+
<a class="entry-name" href="{{$submoduleLink.RepoWebLink}}" title="{{$entry.Name}}">{{$entry.Name}}</a>
23+
@ <a class="text primary" href="{{$submoduleLink.CommitWebLink}}">{{ShortSha $submoduleFile.RefID}}</a>
2324
{{else}}
24-
{{$entry.Name}} <span class="at">@</span> {{ShortSha $submoduleFile.RefID}}
25+
<span class="entry-name" title="{{$entry.Name}}">{{$entry.Name}}</span>
26+
@ {{ShortSha $submoduleFile.RefID}}
2527
{{end}}
2628
{{else}}
2729
{{if $entry.IsDir}}
2830
{{$subJumpablePathName := $entry.GetSubJumpablePathName}}
29-
<a class="muted" href="{{$.TreeLink}}/{{PathEscapeSegments $subJumpablePathName}}" title="{{$subJumpablePathName}}">
31+
<a class="entry-name" href="{{$.TreeLink}}/{{PathEscapeSegments $subJumpablePathName}}" title="{{$subJumpablePathName}}">
3032
{{$subJumpablePathFields := StringUtils.Split $subJumpablePathName "/"}}
3133
{{$subJumpablePathFieldLast := (Eval (len $subJumpablePathFields) "-" 1)}}
3234
{{if eq $subJumpablePathFieldLast 0}}
@@ -37,7 +39,7 @@
3739
{{end}}
3840
</a>
3941
{{else}}
40-
<a class="muted" href="{{$.TreeLink}}/{{PathEscapeSegments $entry.Name}}" title="{{$entry.Name}}">{{$entry.Name}}</a>
42+
<a class="entry-name" href="{{$.TreeLink}}/{{PathEscapeSegments $entry.Name}}" title="{{$entry.Name}}">{{$entry.Name}}</a>
4143
{{end}}
4244
{{end}}
4345
</div>

web_src/css/repo/home-file-list.css

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
}
1515
}
1616

17-
#repo-files-table .repo-file-cell.name .svg {
18-
margin-right: 2px;
19-
}
20-
2117
#repo-files-table .svg.octicon-file-directory-fill,
2218
#repo-files-table .svg.octicon-file-submodule {
2319
color: var(--color-primary);
@@ -70,11 +66,25 @@
7066
}
7167

7268
#repo-files-table .repo-file-cell.name {
69+
display: flex;
70+
align-items: center;
71+
gap: 0.5em;
72+
overflow: hidden;
73+
}
74+
75+
#repo-files-table .repo-file-cell.name > a,
76+
#repo-files-table .repo-file-cell.name > span {
77+
flex-shrink: 0;
7378
white-space: nowrap;
7479
overflow: hidden;
7580
text-overflow: ellipsis;
7681
}
7782

83+
#repo-files-table .repo-file-cell.name .entry-name {
84+
flex-shrink: 1;
85+
min-width: 3em;
86+
}
87+
7888
@media (max-width: 767.98px) {
7989
#repo-files-table .repo-file-cell.name {
8090
max-width: 35vw;

0 commit comments

Comments
 (0)