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 <wxiaoguang@gmail.com>
This commit is contained in:
silverwind 2024-12-15 17:56:56 +01:00 committed by GitHub
parent b01b0b99a5
commit 74b06d4f5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 37 additions and 15 deletions

View File

@ -5,9 +5,9 @@
<div>{{if and .LatestCommit .LatestCommit.Committer}}{{DateUtils.TimeSince .LatestCommit.Committer.When}}{{end}}</div> <div>{{if and .LatestCommit .LatestCommit.Committer}}{{DateUtils.TimeSince .LatestCommit.Committer.When}}{{end}}</div>
</div> </div>
{{if .HasParentPath}} {{if .HasParentPath}}
<div class="repo-file-line"> <a class="repo-file-line parent-link silenced" href="{{.BranchLink}}{{if .ParentPath}}{{PathEscapeSegments .ParentPath}}{{end}}">
{{svg "octicon-reply"}} <a class="muted" href="{{.BranchLink}}{{if .ParentPath}}{{PathEscapeSegments .ParentPath}}{{end}}">..</a> {{svg "octicon-file-directory-fill"}} ..
</div> </a>
{{end}} {{end}}
{{range $item := .Files}} {{range $item := .Files}}
<div class="repo-file-item"> <div class="repo-file-item">

View File

@ -1,12 +1,23 @@
#repo-files-table { #repo-files-table {
width: 100%; width: 100%;
display: grid; display: grid;
grid-template-columns: auto 1fr auto; grid-template-columns: 2fr 3fr auto;
border: 1px solid var(--color-light-border); border: 1px solid var(--color-secondary);
background: var(--color-box-body);
border-radius: var(--border-radius); border-radius: var(--border-radius);
margin: 10px 0; /* match the "clone-panel-popup" margin to avoid "visual double-border" */ margin: 10px 0; /* match the "clone-panel-popup" margin to avoid "visual double-border" */
} }
@media (max-width: 767.98px) {
#repo-files-table {
grid-template-columns: auto 1fr auto;
}
}
#repo-files-table .repo-file-cell.name .svg {
margin-right: 2px;
}
#repo-files-table .svg.octicon-file-directory-fill, #repo-files-table .svg.octicon-file-directory-fill,
#repo-files-table .svg.octicon-file-submodule { #repo-files-table .svg.octicon-file-submodule {
color: var(--color-primary); color: var(--color-primary);
@ -22,18 +33,28 @@
display: contents; display: contents;
} }
#repo-files-table .repo-file-item:hover > .repo-file-cell { #repo-files-table .repo-file-item:hover > .repo-file-cell,
background: var(--color-hover); #repo-files-table .parent-link:hover {
background: var(--color-hover-opaque);
} }
#repo-files-table .repo-file-line, #repo-files-table .repo-file-line,
#repo-files-table .repo-file-cell { #repo-files-table .repo-file-cell {
border-top: 1px solid var(--color-light-border); border-top: 1px solid var(--color-secondary);
padding: 8px 10px; padding: 8px 10px;
} }
#repo-files-table .repo-file-line:first-child { #repo-files-table .repo-file-line:first-child {
border-top: none; border-top: none;
border-radius: var(--border-radius) var(--border-radius) 0 0;
}
#repo-files-table .repo-file-item:last-child .repo-file-cell:first-child {
border-bottom-left-radius: calc(var(--border-radius) - 1px);
}
#repo-files-table .repo-file-item:last-child .repo-file-cell:last-child {
border-bottom-right-radius: calc(var(--border-radius) - 1px);
} }
#repo-files-table .repo-file-line { #repo-files-table .repo-file-line {
@ -48,12 +69,17 @@
} }
#repo-files-table .repo-file-cell.name { #repo-files-table .repo-file-cell.name {
max-width: 300px;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
@media (max-width: 767.98px) {
#repo-files-table .repo-file-cell.name {
max-width: 35vw;
}
}
#repo-files-table .repo-file-cell.message { #repo-files-table .repo-file-cell.message {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
@ -66,9 +92,3 @@
white-space: nowrap; white-space: nowrap;
color: var(--color-text-light-1); color: var(--color-text-light-1);
} }
@media (max-width: 767.98px) {
#repo-files-table .repo-file-cell.name {
max-width: 150px;
}
}

View File

@ -203,6 +203,7 @@
--color-light-mimic-enabled: rgba(0, 0, 0, calc(40 / 255 * 222 / 255 / var(--opacity-disabled))); --color-light-mimic-enabled: rgba(0, 0, 0, calc(40 / 255 * 222 / 255 / var(--opacity-disabled)));
--color-light-border: #e8f3ff28; --color-light-border: #e8f3ff28;
--color-hover: #e8f3ff19; --color-hover: #e8f3ff19;
--color-hover-opaque: #21252a; /* TODO: color-mix(in srgb, var(--color-body), var(--color-hover)); */
--color-active: #e8f3ff24; --color-active: #e8f3ff24;
--color-menu: #171a1e; --color-menu: #171a1e;
--color-card: #171a1e; --color-card: #171a1e;

View File

@ -203,6 +203,7 @@
--color-light-mimic-enabled: rgba(0, 0, 0, calc(6 / 255 * 222 / 255 / var(--opacity-disabled))); --color-light-mimic-enabled: rgba(0, 0, 0, calc(6 / 255 * 222 / 255 / var(--opacity-disabled)));
--color-light-border: #0000171d; --color-light-border: #0000171d;
--color-hover: #00001708; --color-hover: #00001708;
--color-hover-opaque: #f1f3f5; /* TODO: color-mix(in srgb, var(--color-body), var(--color-hover)); */
--color-active: #00001714; --color-active: #00001714;
--color-menu: #f8f9fb; --color-menu: #f8f9fb;
--color-card: #f8f9fb; --color-card: #f8f9fb;