Skip to content

Commit 4185013

Browse files
committed
docs: restore custom docs header
1 parent 28fa0db commit 4185013

3 files changed

Lines changed: 130 additions & 23 deletions

File tree

docs/astro.config.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ export default defineConfig({
4747
starlight({
4848
title: "Sentry CLI",
4949
favicon: "/favicon.png",
50+
logo: {
51+
src: "./src/assets/logo.svg",
52+
replacesTitle: true,
53+
},
5054
social: [
5155
{
5256
icon: "github",

docs/src/components/Header.astro

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
11
---
2-
import SentryThemeHeader from "@sentry/starlight-theme/components/Header.astro";
2+
import config from "virtual:starlight/user-config";
3+
4+
import Search from "virtual:starlight/components/Search";
5+
import SiteTitle from "virtual:starlight/components/SiteTitle";
36
import SocialIcons from "virtual:starlight/components/SocialIcons";
47
58
const isHomepage = Astro.locals.starlightRoute.id === "";
9+
const shouldRenderSearch =
10+
config.pagefind ||
11+
config.components.Search !== "@astrojs/starlight/components/Search.astro";
612
713
const baseUrl = import.meta.env.BASE_URL;
814
const base = baseUrl.endsWith("/") ? baseUrl : baseUrl + "/";
915
---
1016

11-
{isHomepage ? (
12-
<!-- Homepage: custom landing-page header; docs pages use the shared theme header. -->
13-
<div class="header sl-flex header-homepage">
14-
<div class="sl-flex header-left">
15-
<a href={base} class="site-title sl-flex">
16-
<img src={`${base}wordmark-light.svg`} alt="Sentry CLI" class="homepage-logo" />
17-
</a>
18-
</div>
19-
<div class="sl-flex header-right">
20-
<a href={`${base}getting-started/`} class="header-nav-link">Docs</a>
21-
<SocialIcons />
22-
</div>
17+
<div class:list={["header", "sl-flex", { "header-homepage": isHomepage }]}>
18+
<div class="sl-flex header-left">
19+
<SiteTitle />
20+
</div>
21+
22+
<div class="sl-flex header-right">
23+
{!isHomepage && shouldRenderSearch && <Search />}
24+
{isHomepage && <a href={`${base}getting-started/`} class="header-nav-link">Docs</a>}
25+
{!isHomepage && <span class="header-nav-link header-nav-active">Docs</span>}
26+
<SocialIcons />
2327
</div>
24-
) : (
25-
<SentryThemeHeader />
26-
)}
28+
</div>
2729

2830
<style>
2931
.header {
@@ -50,11 +52,6 @@ const base = baseUrl.endsWith("/") ? baseUrl : baseUrl + "/";
5052
align-items: center;
5153
}
5254

53-
.homepage-logo {
54-
height: 2.3rem;
55-
width: auto;
56-
}
57-
5855
.header-nav-link {
5956
color: #fff !important;
6057
text-decoration: none;
@@ -71,4 +68,13 @@ const base = baseUrl.endsWith("/") ? baseUrl : baseUrl + "/";
7168
opacity: 1;
7269
background: rgba(255, 255, 255, 0.1);
7370
}
71+
72+
.header-nav-active {
73+
opacity: 1;
74+
cursor: default;
75+
}
76+
77+
.header-nav-active:hover {
78+
background: none;
79+
}
7480
</style>

docs/src/styles/cli.css

Lines changed: 99 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
/* CLI uses Inter + JetBrains Mono */
1313
--sl-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
1414
--sl-font-mono: "JetBrains Mono", ui-monospace, monospace;
15+
16+
/* Match the original CLI docs header sizing. */
17+
--sl-nav-height: 4rem !important;
18+
--sl-nav-pad-x: 1.5rem !important;
19+
--sl-nav-gap: 2rem !important;
1520
}
1621

1722
/* Subtle background gradient glow */
@@ -39,17 +44,109 @@
3944

4045
/* GitHub icon - white in header */
4146
.social-icons a,
42-
.social-icons a svg {
47+
.social-icons a svg,
48+
a[href*="github.com"],
49+
a[href*="github.com"] svg {
4350
color: #fff !important;
4451
fill: #fff !important;
4552
}
4653

4754
.social-icons a:hover,
48-
.social-icons a:hover svg {
55+
.social-icons a:hover svg,
56+
a[href*="github.com"]:hover,
57+
a[href*="github.com"]:hover svg {
4958
color: rgba(255, 255, 255, 0.8) !important;
5059
fill: rgba(255, 255, 255, 0.8) !important;
5160
}
5261

62+
/* Header / Navigation */
63+
header.header {
64+
background: rgba(10, 10, 15, 0.95);
65+
backdrop-filter: blur(12px);
66+
border-bottom: none;
67+
}
68+
69+
header.header > .header {
70+
display: flex;
71+
gap: 1rem;
72+
justify-content: space-between;
73+
align-items: center;
74+
height: 100%;
75+
width: 100%;
76+
padding: 0;
77+
background: transparent;
78+
backdrop-filter: none;
79+
}
80+
81+
.header-left {
82+
flex: 0 0 auto;
83+
}
84+
85+
.header-right {
86+
flex: 0 0 auto;
87+
gap: 1rem;
88+
align-items: center;
89+
}
90+
91+
.site-title img {
92+
height: 2.3rem !important;
93+
width: auto !important;
94+
}
95+
96+
starlight-menu-button button {
97+
background-color: #1a1a1f !important;
98+
color: #fff !important;
99+
border: 1px solid rgba(255, 255, 255, 0.2) !important;
100+
box-shadow: none !important;
101+
}
102+
103+
site-search {
104+
--sl-search-width: 22rem;
105+
}
106+
107+
site-search button {
108+
background: var(--sl-color-bg) !important;
109+
border: 1px solid rgba(255, 255, 255, 0.25) !important;
110+
border-radius: 6px !important;
111+
padding: 0.35rem 0.75rem !important;
112+
font-size: 0.8rem !important;
113+
height: auto !important;
114+
min-height: unset !important;
115+
gap: 0.5rem !important;
116+
width: 22rem !important;
117+
min-width: 22rem !important;
118+
justify-content: space-between !important;
119+
position: fixed !important;
120+
left: 50% !important;
121+
transform: translateX(-50%) !important;
122+
top: 0.75rem !important;
123+
z-index: 1000 !important;
124+
}
125+
126+
site-search button:hover {
127+
border-color: rgba(255, 255, 255, 0.4) !important;
128+
}
129+
130+
site-search button svg {
131+
width: 14px !important;
132+
height: 14px !important;
133+
color: rgba(255, 255, 255, 0.5) !important;
134+
}
135+
136+
site-search button span {
137+
font-size: 0.8rem !important;
138+
color: rgba(255, 255, 255, 0.5) !important;
139+
}
140+
141+
site-search button kbd {
142+
background: transparent !important;
143+
border: none !important;
144+
color: rgba(255, 255, 255, 0.5) !important;
145+
font-size: 0.75rem !important;
146+
padding: 0 !important;
147+
box-shadow: none !important;
148+
}
149+
53150
/* Docs section heading accent - keep it below the text, not through it. */
54151
html[data-has-sidebar] .sl-markdown-content h2:not(:where(.not-content *))::before {
55152
bottom: 0.02em;

0 commit comments

Comments
 (0)