@@ -6,64 +6,54 @@ import { useTranslations } from 'next-intl';
66import type { FC } from 'react' ;
77
88import '@orama/ui/styles.css' ;
9-
10- import { OramaProvider , useOrama } from '#site/providers/oramaProvider' ;
119import { SearchboxProvider } from '#site/providers/searchboxProvider' ;
1210
1311import styles from './index.module.css' ;
1412import { InnerSearchboxModal } from './InnerSearchboxModal' ;
13+ import { oramaClient } from './orama-client' ;
1514
1615const Searchbox : FC = ( ) => {
17- const orama = useOrama ( ) ;
1816 const t = useTranslations ( ) ;
1917
2018 return (
21- < div className = { styles . searchboxContainer } >
22- < Modal . Root >
23- < Modal . Trigger
24- type = "button"
25- disabled = { ! orama }
26- enableCmdK
27- className = { styles . searchButton }
28- >
29- < div className = { styles . searchButtonContent } >
30- < MagnifyingGlassIcon />
31- { t ( 'components.search.searchPlaceholder' ) }
32- </ div >
33- < span className = { styles . searchButtonShortcut } > ⌘ K</ span >
34- </ Modal . Trigger >
35-
36- < Modal . Wrapper
37- closeOnOutsideClick
38- closeOnEscape
39- className = { styles . modalWrapper }
40- >
41- < SearchRoot client = { orama ?? null } >
42- < ChatRoot
43- client = { orama ?? null }
44- askOptions = { { throttle_delay : 50 } }
45- >
46- < Modal . Inner className = { styles . modalInner } >
47- < Modal . Content className = { styles . modalContent } >
48- < InnerSearchboxModal />
49- </ Modal . Content >
50- </ Modal . Inner >
51- </ ChatRoot >
52- </ SearchRoot >
53- </ Modal . Wrapper >
54- </ Modal . Root >
55- </ div >
56- ) ;
57- } ;
58-
59- const OramaSearchWrapper = ( ) => {
60- return (
61- < OramaProvider >
62- < SearchboxProvider >
63- < Searchbox />
64- </ SearchboxProvider >
65- </ OramaProvider >
19+ < SearchboxProvider >
20+ < div className = { styles . searchboxContainer } >
21+ < Modal . Root >
22+ < Modal . Trigger
23+ type = "button"
24+ disabled = { ! oramaClient }
25+ enableCmdK
26+ className = { styles . searchButton }
27+ >
28+ < div className = { styles . searchButtonContent } >
29+ < MagnifyingGlassIcon />
30+ { t ( 'components.search.searchPlaceholder' ) }
31+ </ div >
32+ < span className = { styles . searchButtonShortcut } > ⌘ K</ span >
33+ </ Modal . Trigger >
34+
35+ < Modal . Wrapper
36+ closeOnOutsideClick
37+ closeOnEscape
38+ className = { styles . modalWrapper }
39+ >
40+ < SearchRoot client = { oramaClient } >
41+ < ChatRoot
42+ client = { oramaClient }
43+ askOptions = { { throttle_delay : 50 } }
44+ >
45+ < Modal . Inner className = { styles . modalInner } >
46+ < Modal . Content className = { styles . modalContent } >
47+ < InnerSearchboxModal />
48+ </ Modal . Content >
49+ </ Modal . Inner >
50+ </ ChatRoot >
51+ </ SearchRoot >
52+ </ Modal . Wrapper >
53+ </ Modal . Root >
54+ </ div >
55+ </ SearchboxProvider >
6656 ) ;
6757} ;
6858
69- export default OramaSearchWrapper ;
59+ export default Searchbox ;
0 commit comments