Skip to content

Commit 62ec861

Browse files
groksrcclaude
andcommitted
Add page breadcrumbs and improve navigation styling
- Add breadcrumb component showing section titles at top of pages - Include page title as h1 and description on all pages - Remove bullets from table of contents - Style h3 items in TOC with lighter color and padding - Reduce h1 size from 4xl to 3xl for better proportion - Add proper margin to hr elements (my-16) - Exclude breadcrumb from homepage 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent d52f41b commit 62ec861

File tree

4 files changed

+90
-41
lines changed

4 files changed

+90
-41
lines changed

src/components/Breadcrumb.astro

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
import { navConfig } from '@/config/navigation'
3+
4+
const currentPath = Astro.url.pathname
5+
6+
// Find the current page in the navigation
7+
let sectionTitle = ''
8+
let pageTitle = ''
9+
10+
for (const section of navConfig.sidebar) {
11+
const item = section.items.find(item => item.href === currentPath)
12+
if (item) {
13+
sectionTitle = section.title
14+
pageTitle = item.title
15+
break
16+
}
17+
}
18+
---
19+
20+
{sectionTitle && currentPath !== '/' && (
21+
<div class="mb-4 text-sm text-gray-600 font-semibold">
22+
<span>{sectionTitle}</span>
23+
</div>
24+
)}

src/components/TableOfContents.astro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@
5656

5757
const a = document.createElement('a');
5858
a.href = `#${id}`;
59-
a.className = 'block py-1 text-gray-600 hover:text-gray-900 transition-colors';
59+
a.className = level === 3
60+
? 'block py-1 pl-4 text-sm text-gray-500 hover:text-gray-900 transition-colors font-normal'
61+
: 'block py-1 text-gray-600 hover:text-gray-900 transition-colors';
6062
a.style.textDecoration = 'none';
6163
a.textContent = title;
6264

src/layouts/DocsLayout.astro

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Header from '@/components/Header.astro'
44
import Sidebar from '@/components/Sidebar.astro'
55
import TableOfContents from '@/components/TableOfContents.astro'
66
import Footer from '@/components/Footer.astro'
7+
import Breadcrumb from '@/components/Breadcrumb.astro'
78
89
export interface Props {
910
title: string
@@ -21,6 +22,11 @@ const { title, description } = Astro.props.frontmatter || Astro.props
2122
<Sidebar />
2223
<main class="flex-1 min-w-0 px-6">
2324
<article class="max-w-4xl py-8">
25+
<Breadcrumb />
26+
<h1>{title}</h1>
27+
{description && (
28+
<p class="text-lg text-gray-600 mt-2 mb-8">{description}</p>
29+
)}
2430
<slot />
2531
</article>
2632
<Footer />

src/styles/global.css

Lines changed: 57 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -58,172 +58,189 @@
5858
font-family: 'Inter', sans-serif;
5959
font-feature-settings: "rlig" 1, "calt" 1;
6060
}
61-
61+
6262
/* Typography */
6363
h1 {
64-
@apply scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl mb-6;
64+
@apply scroll-m-20 text-3xl font-bold tracking-tight mb-6;
6565
}
66-
66+
6767
h2 {
6868
@apply scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 mt-12 mb-4;
6969
}
70-
70+
7171
h3 {
7272
@apply scroll-m-20 text-2xl font-semibold tracking-tight;
7373
}
74-
74+
7575
/* Article content h3 spacing - only applies to h3 in main content */
7676
article > h3:not([class*="text-lg"]) {
7777
@apply mt-8 mb-4;
7878
}
79-
79+
8080
h4 {
8181
@apply scroll-m-20 text-xl font-semibold tracking-tight;
8282
}
83-
83+
8484
p {
8585
@apply leading-7 [&:not(:first-child)]:mt-6;
8686
color: #3e3e3e;
8787
font-size: 16px;
8888
}
89-
89+
9090
blockquote {
9191
@apply mt-6 border-l-2 pl-6 italic;
9292
}
93-
93+
9494
ul {
9595
@apply my-4 ml-6 list-disc [&>li]:mt-2;
9696
}
97-
97+
9898
ol {
9999
@apply my-6 ml-6 list-decimal [&>li]:mt-2;
100100
}
101-
101+
102102
li {
103103
color: #3e3e3e;
104104
}
105-
105+
106106
code {
107107
@apply relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm;
108108
}
109-
109+
110110
pre {
111111
@apply mb-4 mt-6 overflow-x-auto rounded-lg bg-gray-100/50 dark:bg-gray-900 p-4 pr-12 border border-gray-200 dark:border-gray-800;
112112
}
113-
113+
114114
pre code {
115115
@apply bg-transparent p-0 text-gray-900 dark:text-gray-100 font-light;
116116
}
117-
117+
118118
/* Code block wrapper */
119119
.code-block-wrapper {
120120
@apply relative;
121121
}
122-
122+
123123
.code-block-wrapper .copy-button {
124124
@apply absolute top-2 right-2 p-2 rounded-md bg-transparent text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300 transition-colors;
125125
}
126-
126+
127127
.code-block-wrapper .copy-button.copied {
128128
@apply text-green-600 dark:text-green-400;
129129
}
130-
130+
131131
/* Markdown syntax highlighting */
132132
pre code .line {
133133
display: inline-block;
134134
width: 100%;
135135
}
136-
136+
137137
/* Markdown headings in code blocks */
138138
pre code .token.title,
139139
pre code .token.heading {
140140
@apply text-blue-600 dark:text-blue-400 font-semibold;
141141
}
142-
142+
143143
pre code .token.punctuation.heading {
144144
@apply text-blue-600 dark:text-blue-400;
145145
}
146-
146+
147147
/* Markdown links */
148148
pre code .token.link,
149149
pre code .token.url {
150150
@apply text-purple-600 dark:text-purple-400;
151151
}
152-
152+
153153
/* Markdown bold/italic */
154154
pre code .token.bold {
155155
@apply font-semibold;
156156
}
157-
157+
158158
pre code .token.italic {
159159
font-style: italic;
160160
}
161-
161+
162162
/* Markdown lists */
163163
pre code .token.list {
164164
@apply text-gray-600 dark:text-gray-400;
165165
}
166-
166+
167167
/* Markdown code */
168168
pre code .token.code {
169169
@apply bg-gray-200 dark:bg-gray-800 px-1 rounded;
170170
}
171-
171+
172172
a {
173173
@apply font-medium text-primary hover:text-primary/80;
174174
}
175-
175+
176176
table {
177177
@apply w-full;
178178
}
179-
179+
180180
table thead tr {
181181
@apply m-0 border-t p-0 even:bg-muted;
182182
}
183-
183+
184184
table thead th {
185185
@apply border px-4 py-2 text-left font-bold [&[align=center]]:text-center [&[align=right]]:text-right;
186186
}
187-
187+
188188
table tbody tr {
189189
@apply m-0 border-t p-0 even:bg-muted;
190190
}
191-
191+
192192
table tbody td {
193193
@apply border px-4 py-2 text-left [&[align=center]]:text-center [&[align=right]]:text-right;
194194
}
195-
195+
196+
hr {
197+
@apply my-16 border-gray-200;
198+
}
199+
196200
img {
197201
@apply rounded-lg my-6 cursor-pointer transition-opacity hover:opacity-90;
198202
}
199-
203+
200204
/* Full screen image viewer */
201205
.image-viewer {
202206
@apply fixed inset-0 z-50 bg-black/90 flex items-center justify-center p-4 opacity-0 invisible transition-all duration-300;
203207
}
204-
208+
205209
.image-viewer.active {
206210
@apply opacity-100 visible;
207211
}
208-
212+
209213
.image-viewer img {
210214
@apply max-w-full max-h-full object-contain rounded-lg cursor-default;
211215
}
212-
216+
213217
.image-viewer-close {
214218
@apply absolute top-4 right-4 w-10 h-10 flex items-center justify-center rounded-full bg-white/10 text-white hover:bg-white/20 transition-colors cursor-pointer;
215219
}
216-
220+
217221
/* Steps component numbering */
218222
.steps-container {
219223
counter-reset: step-counter;
220224
}
221-
225+
222226
.step-item {
223227
counter-increment: step-counter;
224228
}
225-
229+
226230
.step-item .step-number::before {
227231
content: counter(step-counter);
228232
}
229-
}
233+
234+
/* Table of Contents styles */
235+
#toc-list {
236+
list-style: none;
237+
padding: 0;
238+
margin: 0;
239+
}
240+
241+
#toc-list li {
242+
list-style: none;
243+
padding: 0;
244+
margin: 0;
245+
}
246+
}

0 commit comments

Comments
 (0)