This repository was archived by the owner on Jun 11, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
packages/docsearch-react/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ interface DocSearchProps
2727 appId ?: string ;
2828 apiKey : string ;
2929 indexName : string ;
30+ placeholder ?: string ;
3031 searchParameters ?: any ;
3132 onClose ?( ) : void ;
3233 transformItems ?( items : DocSearchHit [ ] ) : DocSearchHit [ ] ;
@@ -40,6 +41,7 @@ export function DocSearch({
4041 appId = 'BH4D9OD16A' ,
4142 apiKey,
4243 indexName,
44+ placeholder = 'Search docs' ,
4345 searchParameters,
4446 onClose = noop ,
4547 transformItems = x => x ,
@@ -112,7 +114,7 @@ export function DocSearch({
112114 id : 'docsearch' ,
113115 defaultHighlightedIndex : 0 ,
114116 autoFocus : true ,
115- placeholder : 'Search docs' ,
117+ placeholder,
116118 openOnFocus : true ,
117119 initialState : {
118120 query : initialQuery ,
@@ -267,6 +269,7 @@ export function DocSearch({
267269 favoriteSearches ,
268270 saveRecentSearch ,
269271 initialQuery ,
272+ placeholder ,
270273 navigator ,
271274 transformItems ,
272275 ]
@@ -310,20 +313,19 @@ export function DocSearch({
310313 return (
311314 < div
312315 ref = { containerRef }
316+ { ...getRootProps ( { } ) }
313317 className = { [
314318 'DocSearch-Container' ,
315319 state . status === 'stalled' && 'DocSearch-Container--Stalled' ,
316320 state . status === 'error' && 'DocSearch-Container--Errored' ,
317321 ]
318322 . filter ( Boolean )
319323 . join ( ' ' ) }
320- { ...getRootProps ( {
321- onClick ( event : React . MouseEvent ) {
322- if ( event . target === event . currentTarget ) {
323- onClose ( ) ;
324- }
325- } ,
326- } ) }
324+ onClick = { event => {
325+ if ( event . target === event . currentTarget ) {
326+ onClose ( ) ;
327+ }
328+ } }
327329 >
328330 < div className = "DocSearch-Modal" >
329331 < header className = "DocSearch-SearchBar" ref = { searchBoxRef } >
You can’t perform that action at this time.
0 commit comments