source.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import {
  2. CardsThree,
  3. ChartLine,
  4. FolderSimpleDashed,
  5. Gavel,
  6. Lightning,
  7. Shuffle,
  8. DiceSix,
  9. Sparkle,
  10. RocketLaunch,
  11. FileText,
  12. MagnifyingGlass,
  13. Shield,
  14. Gauge,
  15. Bug,
  16. ShieldCheck,
  17. ArrowsClockwise,
  18. WarningCircle,
  19. Code,
  20. Book,
  21. CurrencyDollar,
  22. } from "@phosphor-icons/react/dist/ssr";
  23. import type { InferMetaType, InferPageType } from "fumadocs-core/source";
  24. import { loader } from "fumadocs-core/source";
  25. import { createElement } from "react";
  26. import { docs } from "../.source";
  27. const icons: Record<string, React.ComponentType> = {
  28. CardsThree,
  29. ChartLine,
  30. Gavel,
  31. Lightning,
  32. Shuffle,
  33. DiceSix,
  34. Sparkle,
  35. RocketLaunch,
  36. FileText,
  37. MagnifyingGlass,
  38. Shield,
  39. Gauge,
  40. Bug,
  41. ShieldCheck,
  42. ArrowsClockwise,
  43. WarningCircle,
  44. Code,
  45. Book,
  46. CurrencyDollar,
  47. };
  48. export const source = loader({
  49. baseUrl: "/",
  50. icon(icon) {
  51. return icon ? createElement(icons[icon] ?? FolderSimpleDashed) : undefined;
  52. },
  53. source: docs.toFumadocsSource(),
  54. });
  55. export type Page = InferPageType<typeof source>;
  56. export type Meta = InferMetaType<typeof source>;