From e5ed60d338aba9ccb76b51d55f4d6e8e47c54309 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Fri, 8 Aug 2025 11:02:56 +0000 Subject: [PATCH] Create docs layout with nested routing cgen-22965d3b094e44a884b7217678bdfd69 --- client/pages/DocsLayout.tsx | 195 ++++++++++++++++++++++++++++++++++++ 1 file changed, 195 insertions(+) create mode 100644 client/pages/DocsLayout.tsx diff --git a/client/pages/DocsLayout.tsx b/client/pages/DocsLayout.tsx new file mode 100644 index 00000000..fb5b5f7a --- /dev/null +++ b/client/pages/DocsLayout.tsx @@ -0,0 +1,195 @@ +import { useState } from "react"; +import { Link, Outlet, useLocation } from "react-router-dom"; +import Layout from "@/components/Layout"; +import { Input } from "@/components/ui/input"; +import { Badge } from "@/components/ui/badge"; +import { + BookOpen, + FileText, + Video, + Code, + Terminal, + Search, + Home, + ChevronRight, + Menu, + X, +} from "lucide-react"; + +const navigation = [ + { + name: "Overview", + href: "/docs", + icon: Home, + exact: true, + }, + { + name: "Getting Started", + href: "/docs/getting-started", + icon: BookOpen, + }, + { + name: "Tutorials", + href: "/docs/tutorials", + icon: Video, + badge: "New", + }, + { + name: "API Reference", + href: "/docs/api", + icon: Code, + }, + { + name: "CLI Tools", + href: "/docs/cli", + icon: Terminal, + }, + { + name: "Examples", + href: "/docs/examples", + icon: FileText, + }, +]; + +export default function DocsLayout() { + const [searchQuery, setSearchQuery] = useState(""); + const [sidebarOpen, setSidebarOpen] = useState(false); + const location = useLocation(); + + const isActive = (href: string, exact = false) => { + if (exact) { + return location.pathname === href; + } + return location.pathname.startsWith(href); + }; + + const getBreadcrumb = () => { + const path = location.pathname; + const segments = path.split('/').filter(Boolean); + + if (segments.length <= 1) return []; + + const breadcrumbs = []; + let currentPath = ''; + + segments.forEach((segment, index) => { + currentPath += `/${segment}`; + if (index > 0) { // Skip the first 'docs' segment + breadcrumbs.push({ + name: segment.charAt(0).toUpperCase() + segment.slice(1).replace('-', ' '), + href: currentPath, + isLast: index === segments.length - 1 + }); + } + }); + + return breadcrumbs; + }; + + const breadcrumbs = getBreadcrumb(); + + return ( + +
+
+ {/* Header */} +
+
+
+

+ AeThex Documentation +

+

+ Comprehensive guides, tutorials, and API references +

+
+ +
+ + {/* Breadcrumb */} + {breadcrumbs.length > 0 && ( + + )} + + {/* Search */} +
+ + setSearchQuery(e.target.value)} + className="pl-10 bg-slate-800/50 border-slate-600 text-white" + /> +
+
+ +
+ {/* Sidebar */} +
+
+ +
+
+ + {/* Content */} +
+ +
+
+
+
+
+ ); +}