diff --git a/docs/app/layout.tsx b/docs/app/layout.tsx index 71f68930..d2339882 100644 --- a/docs/app/layout.tsx +++ b/docs/app/layout.tsx @@ -1,5 +1,7 @@ import "@/app/global.css" -import { RootProvider } from "fumadocs-ui/provider" +// import { RootProvider } from "fumadocs-ui/provider" +import { Provider } from "./provider" + import { Inter } from "next/font/google" const inter = Inter({ @@ -10,7 +12,7 @@ export default function Layout({ children }: LayoutProps<"/">) { return ( - {children} + {children} ) diff --git a/docs/app/provider.tsx b/docs/app/provider.tsx new file mode 100644 index 00000000..aa24797c --- /dev/null +++ b/docs/app/provider.tsx @@ -0,0 +1,17 @@ +"use client" +import { RootProvider } from "fumadocs-ui/provider" +// your custom dialog +import SearchDialog from "@/components/search" +import type { ReactNode } from "react" + +export function Provider({ children }: { children: ReactNode }) { + return ( + + {children} + + ) +} diff --git a/docs/components/search.tsx b/docs/components/search.tsx new file mode 100644 index 00000000..9fcfd850 --- /dev/null +++ b/docs/components/search.tsx @@ -0,0 +1,46 @@ +"use client" +import { + SearchDialog, + SearchDialogClose, + SearchDialogContent, + SearchDialogHeader, + SearchDialogIcon, + SearchDialogInput, + SearchDialogList, + SearchDialogOverlay, + type SharedProps +} from "fumadocs-ui/components/dialog/search" +import { useDocsSearch } from "fumadocs-core/search/client" +import { create } from "@orama/orama" +import { useI18n } from "fumadocs-ui/contexts/i18n" + +function initOrama() { + return create({ + schema: { _: "string" }, + // https://docs.orama.com/docs/orama-js/supported-languages + language: "english" + }) +} + +export default function DefaultSearchDialog(props: SharedProps) { + const { locale } = useI18n() // (optional) for i18n + const { search, setSearch, query } = useDocsSearch({ + type: "static", + initOrama, + locale + }) + + return ( + + + + + + + + + + + + ) +} diff --git a/docs/package.json b/docs/package.json index 38887ffc..3c2f7760 100644 --- a/docs/package.json +++ b/docs/package.json @@ -13,6 +13,7 @@ "postinstall": "fumadocs-mdx" }, "dependencies": { + "@orama/orama": "^3.1.11", "fumadocs-core": "15.7.2", "fumadocs-mdx": "11.8.0", "fumadocs-ui": "15.7.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f096c7f3..6d01a55e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -95,6 +95,9 @@ importers: docs: dependencies: + '@orama/orama': + specifier: ^3.1.11 + version: 3.1.11 fumadocs-core: specifier: 15.7.2 version: 15.7.2(@types/react@19.1.11)(next@15.5.0(@babel/core@7.28.3)(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(react-dom@19.1.1(react@19.1.1))(react@19.1.1)