layout.tsx 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. ],
  29. },
  30. {
  31. title: "API Reference",
  32. items: [
  33. { title: "@json-render/core", href: "/docs/api/core" },
  34. { title: "@json-render/react", href: "/docs/api/react" },
  35. ],
  36. },
  37. ];
  38. export default function DocsLayout({
  39. children,
  40. }: {
  41. children: React.ReactNode;
  42. }) {
  43. return (
  44. <>
  45. <DocsMobileNav />
  46. <div className="max-w-5xl mx-auto px-6 py-8 lg:py-12 flex gap-16">
  47. {/* Sidebar */}
  48. <aside className="w-48 shrink-0 hidden lg:block">
  49. <nav className="sticky top-20 space-y-6">
  50. {navigation.map((section) => (
  51. <div key={section.title}>
  52. <h4 className="text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2">
  53. {section.title}
  54. </h4>
  55. <ul className="space-y-1">
  56. {section.items.map((item) => (
  57. <li key={item.href}>
  58. <Link
  59. href={item.href}
  60. className="text-sm text-muted-foreground hover:text-foreground transition-colors block py-1"
  61. >
  62. {item.title}
  63. </Link>
  64. </li>
  65. ))}
  66. </ul>
  67. </div>
  68. ))}
  69. </nav>
  70. </aside>
  71. {/* Content */}
  72. <div className="flex-1 min-w-0 max-w-2xl">{children}</div>
  73. </div>
  74. </>
  75. );
  76. }