feat(docsearch): forward props to autocomplete-core
This commit is contained in:
parent
935aa81ae7
commit
26a4cc073c
1 changed files with 8 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ import React from 'react';
|
|||
import {
|
||||
createAutocomplete,
|
||||
AutocompleteState,
|
||||
PublicAutocompleteOptions,
|
||||
} from '@francoischalifour/autocomplete-core';
|
||||
import { getAlgoliaHits } from '@francoischalifour/autocomplete-preset-algolia';
|
||||
|
||||
|
|
@ -17,7 +18,11 @@ import { SearchBox } from './SearchBox';
|
|||
import { ScreenState } from './ScreenState';
|
||||
import { Footer } from './Footer';
|
||||
|
||||
interface DocSearchProps {
|
||||
interface DocSearchProps
|
||||
extends Omit<
|
||||
PublicAutocompleteOptions<InternalDocSearchHit>,
|
||||
'onStateChange' | 'getSources'
|
||||
> {
|
||||
appId?: string;
|
||||
apiKey: string;
|
||||
indexName: string;
|
||||
|
|
@ -31,6 +36,7 @@ export function DocSearch({
|
|||
indexName,
|
||||
searchParameters,
|
||||
onClose = noop,
|
||||
...autocompleteProps
|
||||
}: DocSearchProps) {
|
||||
const [state, setState] = React.useState<
|
||||
AutocompleteState<InternalDocSearchHit>
|
||||
|
|
@ -100,6 +106,7 @@ export function DocSearch({
|
|||
initialState: {
|
||||
query: initialQuery,
|
||||
},
|
||||
...autocompleteProps,
|
||||
onStateChange({ state }) {
|
||||
setState(state as any);
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue