@@ -13,8 +13,7 @@ import {
13
13
useNavigate ,
14
14
useParams ,
15
15
} from '@tanstack/react-router'
16
- import type { AnyOrama , SearchParamsFullText , AnyDocument } from '@orama/orama'
17
- import { SearchBox } from '@orama/searchbox'
16
+ import { OramaSearchBox } from '@orama/react-components'
18
17
import { Carbon } from '~/components/Carbon'
19
18
import { Select } from '~/components/Select'
20
19
import { useLocalStorage } from '~/utils/useLocalStorage'
@@ -336,6 +335,8 @@ export function DocsLayout({
336
335
[ menuConfig ]
337
336
)
338
337
338
+ const [ isSearchboxOpen , setIsSearchboxOpen ] = React . useState ( false )
339
+
339
340
const docsMatch = matches . find ( ( d ) => d . pathname . includes ( '/docs' ) )
340
341
341
342
const relativePathname = lastMatch . pathname . replace (
@@ -444,15 +445,6 @@ export function DocsLayout({
444
445
)
445
446
} )
446
447
447
- const oramaSearchParams : SearchParamsFullText < AnyOrama , AnyDocument > = {
448
- threshold : 0 ,
449
- where : {
450
- category : {
451
- eq : capitalize ( libraryId ) ,
452
- } ,
453
- } ,
454
- }
455
-
456
448
const logo = (
457
449
< DocsLogo
458
450
name = { name }
@@ -499,7 +491,12 @@ export function DocsLayout({
499
491
onSelect = { versionConfig . onSelect }
500
492
/>
501
493
</ div >
502
- < ClientOnlySearchButton { ...searchButtonParams } />
494
+ < ClientOnlySearchButton
495
+ { ...searchButtonParams }
496
+ onClick = { ( ) => setIsSearchboxOpen ( true ) }
497
+ >
498
+ Search
499
+ </ ClientOnlySearchButton >
503
500
{ menuItems }
504
501
</ div >
505
502
</ details >
@@ -546,7 +543,20 @@ export function DocsLayout({
546
543
className = { `min-h-screen flex flex-col lg:flex-row w-full transition-all duration-300` }
547
544
>
548
545
< div className = "fixed z-50" >
549
- < SearchBox { ...searchBoxParams } searchParams = { oramaSearchParams } />
546
+ < OramaSearchBox
547
+ { ...searchBoxParams }
548
+ searchParams = { {
549
+ threshold : 0 ,
550
+ where : {
551
+ category : {
552
+ eq : capitalize ( libraryId ! ) as string ,
553
+ } ,
554
+ } as any ,
555
+ } }
556
+ facetProperty = { undefined }
557
+ open = { isSearchboxOpen }
558
+ onSearchboxClosed = { ( ) => setIsSearchboxOpen ( false ) }
559
+ />
550
560
</ div >
551
561
{ smallMenu }
552
562
{ largeMenu }
0 commit comments