Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

feat(docsite): pin component search to top of the sidebar (#2990)

rubyycheung1a62e97b5254
diff --git a/apps/docsite/src/components/DocsShell.tsx b/apps/docsite/src/components/DocsShell.tsx
index edb683455f..08cfbabd51 100644
--- a/apps/docsite/src/components/DocsShell.tsx
+++ b/apps/docsite/src/components/DocsShell.tsx
@@ -102,6 +102,18 @@ export function DocsShell({
// navigation.
const isOnComponentsRoute = pathname.startsWith('/components');
+ const componentSearch = (
+ <TextInput
+ label="Search components"
+ isLabelHidden
+ value={componentQuery}
+ onChange={setComponentQuery}
+ placeholder="Search components…"
+ startIcon={Search}
+ hasClear
+ />
+ );
+
return (
<AppShell
variant="surface"
@@ -109,7 +121,7 @@ export function DocsShell({
mobileNav={{defaultIsMobile}}
topNav={<SharedTopNav />}
sideNav={
- <SideNav>
+ <SideNav topContent={isOnComponentsRoute ? componentSearch : undefined}>
{!isOnComponentsRoute && (
<>
{/* Getting Started */}
@@ -182,16 +194,6 @@ export function DocsShell({
{isOnComponentsRoute && (
<>
<SideNavSection title="Components" isHeaderHidden>
- <TextInput
- label="Search components"
- isLabelHidden
- value={componentQuery}
- onChange={setComponentQuery}
- placeholder="Search components…"
- startIcon={Search}
- hasClear
- style={{marginBottom: 'var(--spacing-3)'}}
- />
{!q && (
<SideNavItem
label="Overview"