Skip to content

Commit

Permalink
feat(docsearch): forward props to autocomplete-core
Browse files Browse the repository at this point in the history
  • Loading branch information
francoischalifour committed Apr 9, 2020
1 parent 935aa81 commit 26a4cc0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/DocSearch.tsx
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import {
createAutocomplete,
AutocompleteState,
PublicAutocompleteOptions,
} from '@francoischalifour/autocomplete-core';
import { getAlgoliaHits } from '@francoischalifour/autocomplete-preset-algolia';

Expand All @@ -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;
Expand All @@ -31,6 +36,7 @@ export function DocSearch({
indexName,
searchParameters,
onClose = noop,
...autocompleteProps
}: DocSearchProps) {
const [state, setState] = React.useState<
AutocompleteState<InternalDocSearchHit>
Expand Down Expand Up @@ -100,6 +106,7 @@ export function DocSearch({
initialState: {
query: initialQuery,
},
...autocompleteProps,
onStateChange({ state }) {
setState(state as any);
},
Expand Down

0 comments on commit 26a4cc0

Please sign in to comment.