layout.tsx 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import Link from "next/link";
  2. import { DocsMobileNav } from "@/components/docs-mobile-nav";
  3. const navigation = [
  4. {
  5. title: "Getting Started",
  6. items: [
  7. { title: "Introduction", href: "/docs" },
  8. { title: "Installation", href: "/docs/installation" },
  9. { title: "Quick Start", href: "/docs/quick-start" },
  10. ],
  11. },
  12. {
  13. title: "Core Concepts",
  14. items: [
  15. { title: "Catalog", href: "/docs/catalog" },
  16. { title: "Components", href: "/docs/components" },
  17. { title: "Data Binding", href: "/docs/data-binding" },
  18. { title: "Actions", href: "/docs/actions" },
  19. { title: "Visibility", href: "/docs/visibility" },
  20. { title: "Validation", href: "/docs/validation" },
  21. ],
  22. },
  23. {
  24. title: "Guides",
  25. items: [
  26. { title: "AI SDK Integration", href: "/docs/ai-sdk" },
  27. { title: "Streaming", href: "/docs/streaming" },
  28. { title: "Code Export", href: "/docs/code-export" },
  29. ],
  30. },
  31. {
  32. title: "API Reference",
  33. items: [
  34. { title: "@json-render/core", href: "/docs/api/core" },
  35. { title: "@json-render/react", href: "/docs/api/react" },
  36. { title: "@json-render/codegen", href: "/docs/api/codegen" },
  37. ],
  38. },
  39. ];
  40. export default function DocsLayout({
  41. children,
  42. }: {
  43. children: React.ReactNode;
  44. }) {
  45. return (
  46. <>
  47. <DocsMobileNav />
  48. <div className="max-w-5xl mx-auto px-6 py-8 lg:py-12 flex gap-16">
  49. {/* Sidebar */}
  50. <aside className="w-48 shrink-0 hidden lg:block">
  51. <nav className="sticky top-20 space-y-6">
  52. {navigation.map((section) => (
  53. <div key={section.title}>
  54. <h4 className="text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2">
  55. {section.title}
  56. </h4>
  57. <ul className="space-y-1">
  58. {section.items.map((item) => (
  59. <li key={item.href}>
  60. <Link
  61. href={item.href}
  62. className="text-sm text-muted-foreground hover:text-foreground transition-colors block py-1"
  63. >
  64. {item.title}
  65. </Link>
  66. </li>
  67. ))}
  68. </ul>
  69. </div>
  70. ))}
  71. </nav>
  72. </aside>
  73. {/* Content */}
  74. <div className="flex-1 min-w-0 max-w-2xl">{children}</div>
  75. </div>
  76. </>
  77. );
  78. }