feat: Implement Algolia DocSearch, enhance MDX components, and update build configurations.

This commit is contained in:
gitfromwildan
2026-02-08 23:10:20 +07:00
parent 8b3de652bb
commit 099c384d9d
43 changed files with 1617 additions and 1156 deletions

32
components/DocSearch.tsx Normal file
View File

@@ -0,0 +1,32 @@
"use client";
import React from "react";
import { DocSearch } from "@docsearch/react";
export default function DocSearchComponent() {
const appId = process.env.NEXT_PUBLIC_ALGOLIA_DOCSEARCH_APP_ID;
const apiKey = process.env.NEXT_PUBLIC_ALGOLIA_DOCSEARCH_API_KEY;
const indexName = process.env.NEXT_PUBLIC_ALGOLIA_DOCSEARCH_INDEX_NAME;
if (!appId || !apiKey || !indexName) {
console.error(
"DocSearch credentials are not set in the environment variables."
);
return (
<button className="text-sm text-muted-foreground" disabled>
Search... (misconfigured)
</button>
);
}
return (
<div className="docsearch">
<DocSearch
appId={appId}
apiKey={apiKey}
indexName={indexName}
placeholder="Type something to search..."
/>
</div>
);
}