Skip to content

Commit 96a94f3

Browse files
authored
cleanup index page formatting (#10)
Added one-line horizontal styling with drop shadow on hover, plus date/commit link <img width="986" height="380" alt="image" src="https://github.com/user-attachments/assets/4bebce03-5c7a-4806-9183-40e5e756c54d" /> --------- Signed-off-by: Andrew Duffy <andrew@a10y.dev>
1 parent 96d5fd1 commit 96a94f3

File tree

2 files changed

+82
-15
lines changed

2 files changed

+82
-15
lines changed

index.ts

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ function baseHTML(title: string, content: string, cssPath: string = "styles.css"
7878
<meta charset="UTF-8">
7979
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8080
<title>${escapeHTML(title)}</title>
81+
<link rel="icon" type="image/svg+xml" href="${basePath}vortex_logo.svg">
8182
<link rel="stylesheet" href="${cssPath}">
8283
<script>${THEME_SCRIPT}</script>
8384
</head>
@@ -110,16 +111,32 @@ function escapeHTML(str: string): string {
110111
.replace(/"/g, "&quot;");
111112
}
112113

113-
function indexPage(rfcs: RFC[], liveReload: boolean = false): string {
114-
const sorted = [...rfcs].sort((a, b) => a.number.localeCompare(b.number));
114+
function indexPage(rfcs: RFC[], repoUrl: string | null, liveReload: boolean = false): string {
115+
// Sort in reverse numeric order (newest first)
116+
const sorted = [...rfcs].sort((a, b) => b.number.localeCompare(a.number));
117+
118+
const list = sorted.map(rfc => {
119+
const dateStr = rfc.git.accepted ? formatDate(rfc.git.accepted.date) : "";
120+
121+
let authorHTML = "";
122+
if (rfc.git.author && rfc.git.accepted) {
123+
const commitUrl = repoUrl ? `${repoUrl}/commit/${rfc.git.accepted.hash}` : `https://github.com/${rfc.git.author.login}`;
124+
authorHTML = `
125+
<a href="${commitUrl}" class="rfc-author-link" title="${rfc.git.author.login}">
126+
<img src="${rfc.git.author.avatarUrl}" alt="${rfc.git.author.login}" class="rfc-author-avatar">
127+
<span class="rfc-author-name">${rfc.git.author.login}</span>
128+
</a>`;
129+
}
115130

116-
const list = sorted.map(rfc => `
131+
return `
117132
<li>
118133
<a href="rfc/${rfc.number}.html" class="rfc-item">
119134
<span class="rfc-number">RFC ${rfc.number}</span>
120135
<span class="rfc-title">${escapeHTML(rfc.title)}</span>
121-
</a>
122-
</li>`).join("\n");
136+
<span class="rfc-date">${dateStr}</span>
137+
</a>${authorHTML}
138+
</li>`;
139+
}).join("\n");
123140

124141
const content = `
125142
<h1>Request for Comments</h1>
@@ -374,7 +391,7 @@ async function build(liveReload: boolean = false): Promise<number> {
374391
}
375392

376393
// Generate index page
377-
const indexHTML = indexPage(rfcs, liveReload);
394+
const indexHTML = indexPage(rfcs, repoUrl, liveReload);
378395
await Bun.write("dist/index.html", indexHTML);
379396
console.log("Generated dist/index.html");
380397

styles.css

Lines changed: 59 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -238,20 +238,32 @@ th {
238238
}
239239

240240
.rfc-list li {
241-
border-bottom: 1px solid var(--border);
242-
margin-bottom: 0;
241+
display: flex;
242+
align-items: center;
243+
gap: 1rem;
244+
padding: 0.75rem 1rem;
245+
margin: 0 -1rem;
246+
border-radius: 4px;
247+
transition: box-shadow 0.15s ease, background 0.15s ease;
248+
}
249+
250+
.rfc-list li:hover {
251+
background: var(--bg-alt);
252+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
243253
}
244254

245-
.rfc-list li:last-child {
246-
border-bottom: none;
255+
:root[data-theme="dark"] .rfc-list li:hover {
256+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
247257
}
248258

249259
.rfc-item {
250-
display: block;
251-
padding: 1rem 0;
260+
display: flex;
261+
align-items: center;
262+
gap: 1rem;
263+
flex: 1;
252264
text-decoration: none;
253265
color: var(--fg);
254-
transition: background 0.1s ease;
266+
min-width: 0;
255267
}
256268

257269
.rfc-item:hover {
@@ -262,12 +274,50 @@ th {
262274
.rfc-item .rfc-number {
263275
color: var(--fg-muted);
264276
font-size: 0.875rem;
277+
flex-shrink: 0;
278+
width: 5rem;
265279
}
266280

267281
.rfc-item .rfc-title {
268-
display: block;
269282
font-weight: 500;
270-
margin-top: 0.25rem;
283+
flex: 1;
284+
min-width: 0;
285+
overflow: hidden;
286+
text-overflow: ellipsis;
287+
white-space: nowrap;
288+
}
289+
290+
.rfc-item .rfc-date {
291+
color: var(--fg-muted);
292+
font-size: 0.875rem;
293+
flex-shrink: 0;
294+
}
295+
296+
.rfc-author-link {
297+
display: flex;
298+
align-items: center;
299+
gap: 0.5rem;
300+
color: var(--fg-muted);
301+
text-decoration: none;
302+
flex-shrink: 0;
303+
}
304+
305+
.rfc-author-link:hover {
306+
color: var(--link);
307+
}
308+
309+
.rfc-author-link:hover .rfc-author-name {
310+
text-decoration: underline;
311+
}
312+
313+
.rfc-author-avatar {
314+
width: 24px;
315+
height: 24px;
316+
border-radius: 50%;
317+
}
318+
319+
.rfc-author-name {
320+
font-size: 0.875rem;
271321
}
272322

273323
/* RFC page specific */

0 commit comments

Comments
 (0)