Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ export default defineConfig({
alias: [
{ find: "@components", replacement: new URL("./src/components", import.meta.url).pathname },
{ find: "@constants", replacement: new URL("./src/constants.ts", import.meta.url).pathname },
{ find: "@lib", replacement: new URL("./src/lib", import.meta.url).pathname },
// Resolve scripts subpath to the package so ThemeSelect.astro / SDKSelect.astro keep working.
{
find: "@stainless-api/docs/components/scripts",
Expand Down
3 changes: 3 additions & 0 deletions src/components/Header.astro
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import SiteTitle from "virtual:starlight/components/SiteTitle";
import ThemeSelect from "virtual:starlight/components/ThemeSelect";
import { HEADER_LINKS, TABS } from "virtual:stl-docs-virtual-module";
import { Button } from "@stainless-api/ui-primitives";
import { bannerConfig } from "@lib/banner-config";
import MobileNavTabLinks from "./MobileNavTabLinks.astro";
import NavTabsWithDropdown from "./NavTabsWithDropdown.astro";
import SplashMobileMenuToggle from "./SplashMobileMenuToggle.astro";
Expand All @@ -33,6 +34,8 @@ const { hasSidebar } = Astro.locals.starlightRoute;
const showMobileTabStrip = TABS.length > 0;
---

{bannerConfig.enabled && <div class="sl-banner" set:html={bannerConfig.content} />}

<div
class:list={[
"header",
Expand Down
14 changes: 13 additions & 1 deletion src/content.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,17 @@ const noindexSchema = z.object({
noindex: z.boolean().optional(),
});

/**
* Sitewide banner field (optional, controlled by src/lib/banner-config.ts)
*/
const bannerSchema = z.object({
banner: z
.object({
content: z.string(),
})
.optional(),
});

export const collections = {
docs: defineCollection({
loader: docsLoader(),
Expand All @@ -150,7 +161,8 @@ export const collections = {
.merge(pageLabelsSchema)
.merge(productsSchema)
.merge(learnMoreSchema)
.merge(noindexSchema),
.merge(noindexSchema)
.merge(bannerSchema),
}),
}),
};
8 changes: 8 additions & 0 deletions src/lib/banner-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Sitewide banner configuration
* Toggle the banner on/off by changing `enabled` below
*/
export const bannerConfig = {
enabled: true,
content: 'Join us at <strong><a href="https://www.tigerdata.com/events/aggregate-2026">Tiger Data Aggregate 2026</a></strong> for workshops, talks, and networking.',
};
77 changes: 77 additions & 0 deletions src/styles/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,80 @@ main .sl-anchor-link svg,
white-space: nowrap;
border: 0;
}

/* ---- Sitewide Banner ---- */

.sl-banner {
position: fixed !important;
top: 0 !important;
left: 0 !important;
right: 0 !important;
z-index: 200 !important;
width: 100vw !important;
max-width: none !important;
min-width: 100vw !important;
padding: 0.75rem var(--tiger-content-inset) !important;
background-color: var(--tiger-electric-yellow) !important;
color: var(--tiger-black) !important;
text-align: center !important;
line-height: 1.5 !important;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
border: none !important;
margin: 0 !important;
margin-inline: 0 !important;
}

.sl-banner a {
color: var(--tiger-black);
text-decoration: underline;
}

.sl-banner a:hover {
opacity: 0.7;
}

.sl-banner strong {
font-weight: 600;
}

/* Adjust page and header to account for fixed banner - only when banner exists */
/* Desktop: banner is 48px + nav header ~56px = 104px total scroll padding */
body:has(.sl-banner) {
padding-top: 48px;
scroll-padding-top: 104px;
}

body:has(.sl-banner) .right-sidebar-panel {
top: 104px !important;
}

body:has(.sl-banner) header,
body:has(.sl-banner) .stl-header {
position: sticky !important;
top: 48px !important;
z-index: 100 !important;
background-color: light-dark(#ffffff, #1a1a1a) !important;
}

/* Mobile: banner is 70px + nav header ~64px = 134px total scroll padding */
@media (max-width: 768px) {
.sl-banner {
padding: 0.75rem var(--tiger-space-lg);
font-size: 0.9rem;
}

body:has(.sl-banner) {
padding-top: 70px;
scroll-padding-top: 134px;
}

body:has(.sl-banner) header,
body:has(.sl-banner) .stl-header {
top: 70px !important;
background-color: light-dark(#ffffff, #1a1a1a) !important;
}

body:has(.sl-banner) .right-sidebar-panel {
top: 134px !important;
}
}
Loading