Added icon support to source (#166)

This commit is contained in:
Jonas List 2025-04-17 23:47:43 +02:00 committed by GitHub
parent 0d3d01b0f8
commit 127e6a001f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View file

@ -10,7 +10,8 @@ export default function NotFound() {
404 404
</h1> </h1>
<p className="text-gray-500"> <p className="text-gray-500">
Looks like you&apos;ve ventured into the unknown digital realm. Oops! You&apos;ve wandered off the Zen path. Let&apos;s guide you
back to tranquility.
</p> </p>
</div> </div>
<Link <Link

View file

@ -1,9 +1,19 @@
import { docs } from "@/.source"; import { docs } from "@/.source";
import { loader } from "fumadocs-core/source"; import { loader } from "fumadocs-core/source";
import { icons } from "lucide-react";
import { createElement } from "react";
// `loader()` also assign a URL to your pages // `loader()` also assign a URL to your pages
// See https://fumadocs.vercel.app/docs/headless/source-api for more info // See https://fumadocs.vercel.app/docs/headless/source-api for more info
export const source = loader({ export const source = loader({
icon(icon) {
if (!icon) {
// You may set a default icon
return;
}
if (icon in icons) return createElement(icons[icon as keyof typeof icons]);
},
baseUrl: "/", baseUrl: "/",
source: docs.toFumadocsSource(), source: docs.toFumadocsSource(),
}); });