Skip to content

Commit ff00760

Browse files
markcclaude
andcommitted
Change chapter list to two-column table
- Chapter title/link in first column - Description in second column (muted) - Row hover highlight - Cleaner tabular layout 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 74aaeb4 commit ff00760

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

‎docs/spe.css‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,14 @@ nav.nav-card { border: 1px solid var(--border); border-radius: var(--radius-md);
135135
transition: max-height 0.3s ease, opacity 0.2s ease; }
136136
.sidebar-group.collapsed nav { max-height: 0; opacity: 0; }
137137

138-
/* Chapter list */
139-
.chapter-list { display: flex; flex-direction: column; margin-top: 1rem; }
140-
.chapter-list a { display: block; padding: 0.4rem 0; color: var(--fg); }
141-
.chapter-list a:hover { background: var(--nav-bg); }
142-
.chapter-list strong { font-weight: 600; }
138+
/* Chapter table */
139+
.chapter-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
140+
.chapter-table td { padding: 0.4rem 0; vertical-align: top; }
141+
.chapter-table td:first-child { white-space: nowrap; padding-right: 1rem; }
142+
.chapter-table td:last-child { color: var(--muted); }
143+
.chapter-table tr:hover { background: var(--nav-bg); }
144+
.chapter-table a { color: var(--fg); }
145+
.chapter-table strong { font-weight: 600; }
143146

144147
/* === Forms === */
145148
input, textarea, select, button { font: inherit; padding: 0.5rem 0.75rem; border-radius: var(--radius-sm); }

‎index.php‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,13 @@ final class Theme {
6060
public function __construct(private Ctx $ctx) {}
6161

6262
private function chapterList(): string {
63-
return $this->ctx->chapters
63+
$rows = $this->ctx->chapters
6464
|> (fn($c) => array_map(fn($ch) => sprintf(
65-
'<a href="%s-%s/"><strong>%s %s</strong> — %s</a>',
65+
'<tr><td><a href="%s-%s/"><strong>%s %s</strong></a></td><td>%s</td></tr>',
6666
$ch[0], $ch[1], $ch[0], $ch[1], $ch[2]
6767
), $c))
6868
|> (fn($a) => implode("\n", $a));
69+
return "<table class=\"chapter-table\">$rows</table>";
6970
}
7071

7172
private function nav(): string {
@@ -119,7 +120,7 @@ public function Simple(): string {
119120
<div class="card">
120121
<h2>Chapters</h2>
121122
<p>A progressive PHP 8.5 micro-framework tutorial in 11 chapters</p>
122-
<nav class="chapter-list">$list</nav>
123+
<div class="chapter-list">$list</div>
123124
</div>
124125
</main>
125126
<footer class="text-center mt-3"><small>© 2015-2025 Mark Constable (MIT License)</small></footer>

0 commit comments

Comments
 (0)