Skip to content

Commit 74b06d4

Browse files
Repo file list enhancements (#32835)
1. restore background color 2. fix border radius on top/bottom and on hover 3. parent link is now full-row again, much easier to click 4. parent link now uses directory icon, matching github 5 changed grid layout to remove auto width on file name column which could get too small. 6. mobile layout now shows more of the filename. --------- Co-authored-by: wxiaoguang <[email protected]>
1 parent b01b0b9 commit 74b06d4

File tree

4 files changed

+37
-15
lines changed

4 files changed

+37
-15
lines changed

templates/repo/view_list.tmpl

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
<div>{{if and .LatestCommit .LatestCommit.Committer}}{{DateUtils.TimeSince .LatestCommit.Committer.When}}{{end}}</div>
66
</div>
77
{{if .HasParentPath}}
8-
<div class="repo-file-line">
9-
{{svg "octicon-reply"}} <a class="muted" href="{{.BranchLink}}{{if .ParentPath}}{{PathEscapeSegments .ParentPath}}{{end}}">..</a>
10-
</div>
8+
<a class="repo-file-line parent-link silenced" href="{{.BranchLink}}{{if .ParentPath}}{{PathEscapeSegments .ParentPath}}{{end}}">
9+
{{svg "octicon-file-directory-fill"}} ..
10+
</a>
1111
{{end}}
1212
{{range $item := .Files}}
1313
<div class="repo-file-item">

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

+32-12
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
#repo-files-table {
22
width: 100%;
33
display: grid;
4-
grid-template-columns: auto 1fr auto;
5-
border: 1px solid var(--color-light-border);
4+
grid-template-columns: 2fr 3fr auto;
5+
border: 1px solid var(--color-secondary);
6+
background: var(--color-box-body);
67
border-radius: var(--border-radius);
78
margin: 10px 0; /* match the "clone-panel-popup" margin to avoid "visual double-border" */
89
}
910

11+
@media (max-width: 767.98px) {
12+
#repo-files-table {
13+
grid-template-columns: auto 1fr auto;
14+
}
15+
}
16+
17+
#repo-files-table .repo-file-cell.name .svg {
18+
margin-right: 2px;
19+
}
20+
1021
#repo-files-table .svg.octicon-file-directory-fill,
1122
#repo-files-table .svg.octicon-file-submodule {
1223
color: var(--color-primary);
@@ -22,18 +33,28 @@
2233
display: contents;
2334
}
2435

25-
#repo-files-table .repo-file-item:hover > .repo-file-cell {
26-
background: var(--color-hover);
36+
#repo-files-table .repo-file-item:hover > .repo-file-cell,
37+
#repo-files-table .parent-link:hover {
38+
background: var(--color-hover-opaque);
2739
}
2840

2941
#repo-files-table .repo-file-line,
3042
#repo-files-table .repo-file-cell {
31-
border-top: 1px solid var(--color-light-border);
43+
border-top: 1px solid var(--color-secondary);
3244
padding: 8px 10px;
3345
}
3446

3547
#repo-files-table .repo-file-line:first-child {
3648
border-top: none;
49+
border-radius: var(--border-radius) var(--border-radius) 0 0;
50+
}
51+
52+
#repo-files-table .repo-file-item:last-child .repo-file-cell:first-child {
53+
border-bottom-left-radius: calc(var(--border-radius) - 1px);
54+
}
55+
56+
#repo-files-table .repo-file-item:last-child .repo-file-cell:last-child {
57+
border-bottom-right-radius: calc(var(--border-radius) - 1px);
3758
}
3859

3960
#repo-files-table .repo-file-line {
@@ -48,12 +69,17 @@
4869
}
4970

5071
#repo-files-table .repo-file-cell.name {
51-
max-width: 300px;
5272
white-space: nowrap;
5373
overflow: hidden;
5474
text-overflow: ellipsis;
5575
}
5676

77+
@media (max-width: 767.98px) {
78+
#repo-files-table .repo-file-cell.name {
79+
max-width: 35vw;
80+
}
81+
}
82+
5783
#repo-files-table .repo-file-cell.message {
5884
white-space: nowrap;
5985
overflow: hidden;
@@ -66,9 +92,3 @@
6692
white-space: nowrap;
6793
color: var(--color-text-light-1);
6894
}
69-
70-
@media (max-width: 767.98px) {
71-
#repo-files-table .repo-file-cell.name {
72-
max-width: 150px;
73-
}
74-
}

web_src/css/themes/theme-gitea-dark.css

+1
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@
203203
--color-light-mimic-enabled: rgba(0, 0, 0, calc(40 / 255 * 222 / 255 / var(--opacity-disabled)));
204204
--color-light-border: #e8f3ff28;
205205
--color-hover: #e8f3ff19;
206+
--color-hover-opaque: #21252a; /* TODO: color-mix(in srgb, var(--color-body), var(--color-hover)); */
206207
--color-active: #e8f3ff24;
207208
--color-menu: #171a1e;
208209
--color-card: #171a1e;

web_src/css/themes/theme-gitea-light.css

+1
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@
203203
--color-light-mimic-enabled: rgba(0, 0, 0, calc(6 / 255 * 222 / 255 / var(--opacity-disabled)));
204204
--color-light-border: #0000171d;
205205
--color-hover: #00001708;
206+
--color-hover-opaque: #f1f3f5; /* TODO: color-mix(in srgb, var(--color-body), var(--color-hover)); */
206207
--color-active: #00001714;
207208
--color-menu: #f8f9fb;
208209
--color-card: #f8f9fb;

0 commit comments

Comments
 (0)