patx/gitman
Replace source cards with compact folder and file icon list
Commit fe2c85c · patx · Nov 4 at 2:00AM
Comments
No comments yet.
Diff
diff --git a/static/styles.css b/static/styles.css
index 75dd33a..23a9fe6 100644
--- a/static/styles.css
+++ b/static/styles.css
@@ -348,6 +348,11 @@ th { color: var(--ink); font-weight: 700; }
}
.repo-list { gap: 1rem; }
.card-list { gap: 1rem; }
+.file-list { gap: .125rem; }
+.file-list > li { min-width: 0; }
+.file-link { display: flex; align-items: center; gap: .75rem; min-height: 36px; padding: .375rem .5rem; border-radius: 4px; overflow-wrap: anywhere; }
+.file-link:hover { background: var(--chip); color: var(--ink); text-decoration: none; }
+.file-icon { flex: 0 0 18px; width: 18px; height: 18px; color: var(--muted); }
.comment-list { gap: 1rem; }
.meta-list { display: grid; grid-template-columns: 8rem 1fr; gap: .35rem 1rem; }
diff --git a/templates/base.tpl b/templates/base.tpl
index ef25dcb..d475bcd 100644
--- a/templates/base.tpl
+++ b/templates/base.tpl
@@ -20,7 +20,7 @@
% if not get('landing', False) and theme != 'light':
<link rel="stylesheet" href="/static/vendor/highlight.js/github-dark.min.css"{{!' media="(prefers-color-scheme: dark)"' if theme == 'auto' else ''}}>
% end
- <link rel="stylesheet" href="/static/styles.css?v=20">
+ <link rel="stylesheet" href="/static/styles.css?v=21">
</head>
<body class="{{'landing-page' if get('landing', False) else ''}}">
% if not get("landing", False):
diff --git a/templates/source.tpl b/templates/source.tpl
index c86c57d..4d2a5d2 100644
--- a/templates/source.tpl
+++ b/templates/source.tpl
@@ -23,12 +23,19 @@
<section class="panel">
% if entries:
- <ul class="file-list card-list">
+ <ul class="file-list" aria-label="Files and folders">
% for entry in entries:
<li>
- <a class="feed-card" href="{{url_with_ref('/' + repo['owner_username'] + '/' + repo['name'] + '/src/' + quote_path(entry['path']), selected_ref)}}">
- <span class="activity-title"><strong>{{entry['name']}}{{'/' if entry['type'] == 'dir' else ''}}</strong></span>
- <span class="muted">{{'Directory' if entry['type'] == 'dir' else 'File'}}</span>
+ <a class="file-link" href="{{url_with_ref('/' + repo['owner_username'] + '/' + repo['name'] + '/src/' + quote_path(entry['path']), selected_ref)}}">
+ <svg class="file-icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linejoin="round" aria-hidden="true">
+ % if entry['type'] == 'dir':
+ <path d="M1 4V2.75A.75.75 0 0 1 1.75 2H6l2 2h6.25a.75.75 0 0 1 .75.75v8.5a.75.75 0 0 1-.75.75H1.75a.75.75 0 0 1-.75-.75V4Z"/>
+ % else:
+ <path d="M9.5 1H3.25a.75.75 0 0 0-.75.75v12.5a.75.75 0 0 0 .75.75h9.5a.75.75 0 0 0 .75-.75V5l-4-4Z"/><path d="M9.5 1v4h4"/>
+ % end
+ </svg>
+ <span class="sr-only">{{'Directory:' if entry['type'] == 'dir' else 'File:'}}</span>
+ <span>{{entry['name']}}</span>
</a>
</li>
% end