Skip to content

Commit e4551bc

Browse files
feat(web): add search functionality to docs page with command palette (#2190)
* feat(web): add search functionality to docs page with command palette - Add SearchTrigger component with command palette (Cmd+K shortcut) - Add search bar in left sidebar for desktop view - Add sticky search bar under header for mobile view - Use pagefind for search functionality - Integrate with @hypr/ui Command components Co-Authored-By: [email protected] <[email protected]> * fix(web): add DialogTitle for accessibility and type=button to search triggers Co-Authored-By: [email protected] <[email protected]> * feat(search): refactor search modal to use portal and improve UX * fix(web): use single SearchPaletteProvider to fix multiple palettes, add auto-focus Co-Authored-By: [email protected] <[email protected]> * feat(search): wrap SearchTrigger with SearchPaletteProvider * feat(search): refactor search trigger with cn utility and add header variant --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: [email protected] <[email protected]>
1 parent 7ade93c commit e4551bc

File tree

4 files changed

+435
-75
lines changed

4 files changed

+435
-75
lines changed

apps/web/src/components/header.tsx

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
} from "lucide-react";
99
import { useState } from "react";
1010

11-
import { Search } from "@/components/search";
11+
import { SearchTrigger } from "@/components/search";
1212
import { useDocsDrawer } from "@/hooks/use-docs-drawer";
1313
import { useHandbookDrawer } from "@/hooks/use-handbook-drawer";
1414
import { getPlatformCTA, usePlatform } from "@/hooks/use-platform";
@@ -79,6 +79,8 @@ export function Header() {
7979
setIsMenuOpen={setIsMenuOpen}
8080
docsDrawer={docsDrawer}
8181
handbookDrawer={handbookDrawer}
82+
isDocsPage={isDocsPage}
83+
isHandbookPage={isHandbookPage}
8284
/>
8385
</div>
8486
</div>
@@ -326,14 +328,8 @@ function DesktopNav({
326328
platformCTA: ReturnType<typeof getPlatformCTA>;
327329
}) {
328330
return (
329-
<nav className="hidden sm:flex items-center gap-2">
330-
<Search />
331-
<Link
332-
to="/join-waitlist"
333-
className="px-4 h-8 flex items-center text-sm text-neutral-600 hover:text-neutral-800 transition-all hover:underline decoration-dotted"
334-
>
335-
Get started
336-
</Link>
331+
<nav className="hidden sm:flex items-center gap-4">
332+
<SearchTrigger variant="header" />
337333
<CTAButton platformCTA={platformCTA} />
338334
</nav>
339335
);
@@ -346,17 +342,26 @@ function MobileNav({
346342
setIsMenuOpen,
347343
docsDrawer,
348344
handbookDrawer,
345+
isDocsPage,
346+
isHandbookPage,
349347
}: {
350348
platform: string;
351349
platformCTA: ReturnType<typeof getPlatformCTA>;
352350
isMenuOpen: boolean;
353351
setIsMenuOpen: (open: boolean) => void;
354352
docsDrawer: ReturnType<typeof useDocsDrawer>;
355353
handbookDrawer: ReturnType<typeof useHandbookDrawer>;
354+
isDocsPage: boolean;
355+
isHandbookPage: boolean;
356356
}) {
357+
const hideCTA = isDocsPage || isHandbookPage;
358+
357359
return (
358-
<div className="sm:hidden flex items-center gap-2">
359-
<CTAButton platformCTA={platformCTA} platform={platform} mobile />
360+
<div className="sm:hidden flex items-center gap-3">
361+
<SearchTrigger variant="header" />
362+
{!hideCTA && (
363+
<CTAButton platformCTA={platformCTA} platform={platform} mobile />
364+
)}
360365
<button
361366
onClick={() => {
362367
if (!isMenuOpen) {

0 commit comments

Comments
 (0)