Skip to content

Commit 2faa503

Browse files
committed
fix: vertical alignment of the toc
1 parent 0fe02e7 commit 2faa503

3 files changed

Lines changed: 26 additions & 21 deletions

File tree

src/components/overrides/TableOfContents.astro

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,23 @@ const { editUrl } = Astro.locals.starlightRoute;
4747
{editUrl && (
4848
<a
4949
href={editUrl}
50-
class="group flex items-center gap-2.5 rounded-sm text-[13px] text-[var(--sl-color-gray-3)] transition-colors duration-150 ease-out hover:text-[var(--sl-color-white)] focus-visible:ring-2 focus-visible:ring-[var(--sl-color-text-accent)] focus-visible:outline-none"
51-
>
52-
<Icon
53-
name="pencil"
54-
class="h-3.5 w-3.5 opacity-60 transition-opacity duration-150 group-hover:opacity-100"
55-
aria-hidden="true"
56-
/>
57-
<span>Edit page</span>
58-
</a>
59-
)}
60-
<a
61-
href="https://github.com/cloudflare/cloudflare-docs/issues/new/choose"
62-
class="group flex items-center gap-2.5 rounded-sm text-[13px] text-[var(--sl-color-gray-3)] transition-colors duration-150 ease-out hover:text-[var(--sl-color-white)] focus-visible:ring-2 focus-visible:ring-[var(--sl-color-text-accent)] focus-visible:outline-none"
50+
class="group flex items-center gap-2.5 rounded-sm text-[13px] text-[var(--sl-color-gray-2)] transition-colors duration-150 ease-out hover:text-[var(--sl-color-white)] focus-visible:ring-2 focus-visible:ring-[var(--sl-color-text-accent)] focus-visible:outline-none"
6351
>
6452
<Icon
65-
name="github"
66-
class="h-3.5 w-3.5 opacity-60 transition-opacity duration-150 group-hover:opacity-100"
53+
name="pencil"
54+
class="h-3.5 w-3.5"
55+
aria-hidden="true"
56+
/>
57+
<span>Edit page</span>
58+
</a>
59+
)}
60+
<a
61+
href="https://github.com/cloudflare/cloudflare-docs/issues/new/choose"
62+
class="group flex items-center gap-2.5 rounded-sm text-[13px] text-[var(--sl-color-gray-2)] transition-colors duration-150 ease-out hover:text-[var(--sl-color-white)] focus-visible:ring-2 focus-visible:ring-[var(--sl-color-text-accent)] focus-visible:outline-none"
63+
>
64+
<Icon
65+
name="github"
66+
class="h-3.5 w-3.5"
6767
aria-hidden="true"
6868
/>
6969
<span>Report issue</span>
@@ -155,15 +155,10 @@ const { editUrl } = Astro.locals.starlightRoute;
155155

156156
/* Hover state */
157157
.tb-container ul a:hover {
158-
border-left-color: var(--sidebar-border) !important;
158+
border-left-color: var(--sidebar-border-hover) !important;
159159
color: var(--sidebar-text-strong) !important;
160160
}
161161

162-
/* Light mode: orange border on hover */
163-
:root[data-theme="light"] .tb-container ul a:hover {
164-
border-left-color: var(--orange-accent-200) !important;
165-
}
166-
167162
/* Active state (hooking into starlight's scrollspy) */
168163
.tb-container ul a[aria-current="true"] {
169164
border-left-color: var(--orange-accent-200) !important;

src/styles/sidebar.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
--sidebar-active-bg: var(--color-cl1-gray-9);
4747
--sidebar-active-text: var(--sidebar-text-strong);
4848
--sidebar-border: var(--color-cl1-gray-8);
49+
--sidebar-border-hover: var(--color-cl1-gray-7);
4950
--sl-color-sidebar-active: var(--color-cl1-black);
5051
--sl-color-sidebar-hover: var(--color-cl1-gray-9);
5152
}
@@ -62,6 +63,7 @@
6263
--sidebar-active-bg: var(--sidebar-orange-accent-600);
6364
--sidebar-active-text: var(--orange-accent-200);
6465
--sidebar-border: var(--color-cl1-gray-2);
66+
--sidebar-border-hover: var(--color-cl1-gray-3);
6567
--sl-color-sidebar-active: var(--orange-accent-200);
6668
--sl-color-sidebar-hover: var(--sidebar-orange-accent-600);
6769
}

src/styles/tailwind.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,12 @@
201201
width: 100%;
202202
max-width: 18rem;
203203
}
204+
205+
/* Align "On this page" baseline with the breadcrumbs / "Copy page" button text.
206+
Content panel top = 1rem + breadcrumb padding-top = 0.5rem → 1.5rem to text baseline.
207+
Starlight's default is 1rem, so bump it to match. */
208+
.right-sidebar-panel {
209+
padding-top: 1.5rem !important;
210+
padding-left: 1.5rem !important;
211+
}
204212
}

0 commit comments

Comments
 (0)