From 30e893fa6ec0e9c04f9e575359a2b4693e739366 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 19 Oct 2026 11:15:40 +0800 Subject: [PATCH] feat(web): auto-hiding responsive header, flatter install command Header - Sticky bar that slides out on scroll down and comes back on the first small scroll up (and always near the top). Never hides while the mobile menu is open. Respects prefers-reduced-motion; stays visible without JS. - Phones get a menu button (44px target) with a stacked link panel that closes on link click, Escape, outside tap and resize to desktop. - Sticky sidebar, mobile contents bar and the Commands title now sit below the header only while it is showing (--sticky-offset). - Anchors land below the header (scroll-padding / scroll-margin). - Fix: the mobile docs contents bar never stuck because its wrapper was a box of its own; the wrapper now uses display: contents below 760px. Install command - Replace the outlined box + black button with a single line of type on a rule; the whole row is the copy target, with a copy/check icon. - Hero note: the API key is optional and only adds the AI layer, instead of "No account or API key". Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_019HJc4sv9pSLh7vhduSUxBE --- .../web/src/components/docs/DocsSidebar.astro | 10 +- .../components/landing/CommandsSection.astro | 3 +- .../src/components/landing/CopyCommand.astro | 134 ++++++---- .../src/components/landing/HeroSection.astro | 8 +- .../src/components/landing/SiteHeader.astro | 240 ++++++++++++++++-- apps/web/src/pages/docs.astro | 11 + apps/web/src/styles/docs-prose.css | 11 +- apps/web/src/styles/global.css | 10 +- 8 files changed, 352 insertions(+), 75 deletions(-) diff --git a/apps/web/src/components/docs/DocsSidebar.astro b/apps/web/src/components/docs/DocsSidebar.astro index 41cd1f5..352b69e 100644 --- a/apps/web/src/components/docs/DocsSidebar.astro +++ b/apps/web/src/components/docs/DocsSidebar.astro @@ -99,8 +99,9 @@ const tree = buildTree(headings); diff --git a/apps/web/src/components/landing/HeroSection.astro b/apps/web/src/components/landing/HeroSection.astro index 108d1de..3793582 100644 --- a/apps/web/src/components/landing/HeroSection.astro +++ b/apps/web/src/components/landing/HeroSection.astro @@ -19,7 +19,7 @@ import CopyCommand from "./CopyCommand.astro"; Source on GitHub -

Needs Node 22 or newer. No account or API key to analyze.

+

Needs Node 22 or newer. An API key is optional and only adds the AI layer.

diff --git a/apps/web/src/pages/docs.astro b/apps/web/src/pages/docs.astro index 45cc4a1..441e0fb 100644 --- a/apps/web/src/pages/docs.astro +++ b/apps/web/src/pages/docs.astro @@ -31,6 +31,17 @@ const { Content, headings } = await render(entry); padding-block: 1.5rem 5rem; } + /* + * Below the grid breakpoint the slot only wraps the mobile contents bar. + * Letting its children belong to .docs-page gives that bar the full page + * height to stick within; as a box of its own it would never stick. + */ + @media (max-width: 759px) { + .docs-sidebar-slot { + display: contents; + } + } + @media (min-width: 760px) { .docs-page { display: grid; diff --git a/apps/web/src/styles/docs-prose.css b/apps/web/src/styles/docs-prose.css index f502354..5bcf95e 100644 --- a/apps/web/src/styles/docs-prose.css +++ b/apps/web/src/styles/docs-prose.css @@ -10,7 +10,16 @@ .docs-prose h4 { font-family: var(--font-display); color: var(--ink); - scroll-margin-top: 2rem; +} + +/* On phones the sticky contents bar also sits under the header. */ +@media (max-width: 759px) { + .docs-prose h1, + .docs-prose h2, + .docs-prose h3, + .docs-prose h4 { + scroll-margin-top: 4.5rem; + } } .docs-prose h1 { diff --git a/apps/web/src/styles/global.css b/apps/web/src/styles/global.css index 2dc7299..6cb2e74 100644 --- a/apps/web/src/styles/global.css +++ b/apps/web/src/styles/global.css @@ -26,6 +26,9 @@ --gutter: clamp(1.25rem, 5vw, 4rem); --section-space: clamp(4.5rem, 10vw, 8rem); --radius: 0.5rem; + --header-height: 4.5rem; + /* Sticky elements sit below the site header only while it is showing. */ + --sticky-offset: 0px; background: var(--paper); font-family: var(--font-body); @@ -42,7 +45,12 @@ html { scroll-behavior: smooth; - scroll-padding-top: 2rem; + /* Anchors land below the site header, which may be showing when they scroll. */ + scroll-padding-top: calc(var(--header-height) + 1.5rem); +} + +html[data-header="shown"] { + --sticky-offset: var(--header-height); } body {