mirror of
https://github.com/facebook/docusaurus.git
synced 2025-12-26 01:33:02 +00:00
minor refactor
This commit is contained in:
parent
f9ba304888
commit
b625a0efbe
|
|
@ -67,10 +67,6 @@ interface DocSearchV4Props extends Omit<DocSearchProps, 'askAi'> {
|
|||
translations?: DocSearchTranslations;
|
||||
}
|
||||
|
||||
type SearchBarProps = Partial<
|
||||
Pick<DocSearchModalProps, 'transformSearchClient'>
|
||||
>;
|
||||
|
||||
let DocSearchModal: typeof DocSearchModalType | null = null;
|
||||
|
||||
function importDocSearchModalIfNeeded() {
|
||||
|
|
@ -316,12 +312,15 @@ function DocSearch({externalUrlRegex, ...props}: DocSearchV4Props) {
|
|||
);
|
||||
}
|
||||
|
||||
export default function SearchBar(props: SearchBarProps): ReactNode {
|
||||
export default function SearchBar(props: Partial<DocSearchV4Props>): ReactNode {
|
||||
const {siteConfig} = useDocusaurusContext();
|
||||
return (
|
||||
<DocSearch
|
||||
{...(siteConfig.themeConfig.algolia as DocSearchV4Props)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
|
||||
const docSearchProps: DocSearchV4Props = {
|
||||
...(siteConfig.themeConfig.algolia as DocSearchV4Props),
|
||||
// Let props override theme config
|
||||
// See https://github.com/facebook/docusaurus/pull/11581
|
||||
...props,
|
||||
};
|
||||
|
||||
return <DocSearch {...docSearchProps} />;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue