mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-15 15:41:05 +00:00
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
'use client';
|
|
// components/CustomSearchDialog.tsx
|
|
import { useDocsSearch } from 'fumadocs-core/search/client';
|
|
import {
|
|
SearchDialog,
|
|
SearchDialogOverlay,
|
|
SearchDialogContent,
|
|
SearchDialogHeader,
|
|
SearchDialogIcon,
|
|
SearchDialogInput,
|
|
SearchDialogClose,
|
|
SearchDialogList,
|
|
type SharedProps
|
|
} from 'fumadocs-ui/components/dialog/search';
|
|
import { useI18n } from 'fumadocs-ui/contexts/i18n';
|
|
|
|
export default function CustomSearchDialog(props: SharedProps) {
|
|
const { locale } = useI18n();
|
|
const { search, setSearch, query } = useDocsSearch({
|
|
type: 'fetch',
|
|
api: '/api/search',
|
|
locale
|
|
});
|
|
|
|
return (
|
|
<SearchDialog search={search} onSearchChange={setSearch} isLoading={query.isLoading} {...props}>
|
|
<SearchDialogOverlay />
|
|
<SearchDialogContent>
|
|
<SearchDialogHeader>
|
|
<SearchDialogIcon />
|
|
<SearchDialogInput />
|
|
<SearchDialogClose />
|
|
</SearchDialogHeader>
|
|
<SearchDialogList items={query.data !== 'empty' ? query.data : null} />
|
|
</SearchDialogContent>
|
|
</SearchDialog>
|
|
);
|
|
}
|