Skip to content

Commit 18c5cfc

Browse files
docs: restore homepage header and background gradient
- Re-add custom Header component (derived from theme's Header pattern) with CLI-specific features: homepage detection, 'Docs' nav link, hide search on splash page, social icons in header - Restore the purple/blue ambient gradient glow (.main-frame::before) - Style social icons white in header
1 parent 6100fb9 commit 18c5cfc

3 files changed

Lines changed: 109 additions & 0 deletions

File tree

docs/astro.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export default defineConfig({
6060
],
6161
plugins: [sentryStarlightTheme()],
6262
components: {
63+
Header: "./src/components/Header.astro",
6364
PageTitle: "./src/components/PageTitle.astro",
6465
},
6566
head: [

docs/src/components/Header.astro

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
/**
3+
* CLI-specific Header — extends the shared theme's Header pattern
4+
* with homepage detection, "Docs" nav link, and social icons.
5+
*/
6+
import config from "virtual:starlight/user-config";
7+
8+
import Search from "virtual:starlight/components/Search";
9+
import SiteTitle from "virtual:starlight/components/SiteTitle";
10+
import SocialIcons from "virtual:starlight/components/SocialIcons";
11+
12+
const shouldRenderSearch =
13+
config.pagefind ||
14+
config.components.Search !== "@astrojs/starlight/components/Search.astro";
15+
16+
// Detect homepage (splash page). In Starlight >=0.33, route data lives on
17+
// Astro.locals.starlightRoute; the old `slug` field is now `id`.
18+
const isHomepage = Astro.locals.starlightRoute.id === "";
19+
20+
// Get base path for links
21+
const baseUrl = import.meta.env.BASE_URL;
22+
const base = baseUrl.endsWith("/") ? baseUrl : baseUrl + "/";
23+
---
24+
25+
<div class:list={["header sentry-header", { "header-homepage": isHomepage }]}>
26+
<div class="title-wrapper sl-flex">
27+
<SiteTitle />
28+
</div>
29+
<div class="sentry-header-actions sl-flex print:hidden">
30+
{!isHomepage && shouldRenderSearch && <Search />}
31+
{isHomepage && (
32+
<a href={`${base}getting-started/`} class="header-nav-link">Docs</a>
33+
)}
34+
{!isHomepage && <span class="header-nav-link header-nav-active">Docs</span>}
35+
<div class="sl-hidden md:sl-flex sentry-header-secondary">
36+
<SocialIcons />
37+
</div>
38+
</div>
39+
</div>
40+
41+
<style>
42+
.header-homepage {
43+
max-width: var(--sl-content-width);
44+
margin: 0 auto;
45+
}
46+
47+
.header-nav-link {
48+
color: #fff !important;
49+
text-decoration: none;
50+
font-size: 0.875rem;
51+
font-weight: 500;
52+
padding: 0.4rem 0.75rem;
53+
border-radius: 6px;
54+
transition: all 0.2s ease;
55+
white-space: nowrap;
56+
opacity: 0.9;
57+
}
58+
59+
.header-nav-link:hover {
60+
opacity: 1;
61+
background: rgba(255, 255, 255, 0.1);
62+
}
63+
64+
.header-nav-active {
65+
opacity: 1;
66+
cursor: default;
67+
}
68+
69+
.header-nav-active:hover {
70+
background: none;
71+
}
72+
</style>

docs/src/styles/cli.css

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,42 @@
1414
--sl-font-mono: "JetBrains Mono", ui-monospace, monospace;
1515
}
1616

17+
/* Subtle background gradient glow */
18+
.main-frame::before {
19+
content: "";
20+
position: fixed;
21+
top: 0;
22+
left: 0;
23+
right: 0;
24+
height: 100vh;
25+
background:
26+
radial-gradient(
27+
ellipse 80% 50% at 50% -20%,
28+
rgb(var(--sl-color-accent-rgb) / 0.12) 0%,
29+
transparent 50%
30+
),
31+
radial-gradient(
32+
ellipse 60% 40% at 100% 0%,
33+
rgba(59, 130, 246, 0.08) 0%,
34+
transparent 40%
35+
);
36+
pointer-events: none;
37+
z-index: -1;
38+
}
39+
40+
/* GitHub icon - white in header */
41+
.social-icons a,
42+
.social-icons a svg {
43+
color: #fff !important;
44+
fill: #fff !important;
45+
}
46+
47+
.social-icons a:hover,
48+
.social-icons a:hover svg {
49+
color: rgba(255, 255, 255, 0.8) !important;
50+
fill: rgba(255, 255, 255, 0.8) !important;
51+
}
52+
1753
/* Logo sizing */
1854
.site-title img {
1955
height: 2.3rem;

0 commit comments

Comments
 (0)