Skip to content

Commit dd4fb16

Browse files
committed
feat: add pages and docs pages
1 parent f3c0557 commit dd4fb16

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1618
-956
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,6 @@ npm run test
632632

633633
## Roadmap
634634

635-
- [ ] Documentation site for UI Builder with more hands-on examples
636635
- [ ] Add variable binding to layer children and not just props
637636
- [ ] Update to React 19
638637
- [ ] Update to latest Shadcn/ui + Tailwind CSS v4
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function EditLayout({ children }: { children: React.ReactNode }) {
2+
return <div>{children}</div>;
3+
}

app/docs/[slug]/edit/page.tsx renamed to app/(edit)/docs/[slug]/edit/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
import { notFound } from "next/navigation";
33
import { DocEditor } from "@/app/platform/doc-editor";
4-
import { getDocPageForSlug } from "../../docs-data/data";
4+
import { getDocPageForSlug } from "../../../../docs/docs-data/data";
55

66
export default async function DocEditPage({
77
params,

app/docs/[slug]/page.tsx

Lines changed: 51 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,57 @@
1-
import { AppSidebar } from "@/app/platform/app-sidebar";
2-
import {
3-
Breadcrumb,
4-
BreadcrumbItem,
5-
BreadcrumbLink,
6-
BreadcrumbList,
7-
BreadcrumbPage,
8-
BreadcrumbSeparator,
9-
} from "@/components/ui/breadcrumb";
10-
import {
11-
SidebarInset,
12-
SidebarProvider,
13-
SidebarTrigger,
14-
} from "@/components/ui/sidebar";
151
import { Suspense } from "react";
162
import { DocRenderer } from "@/app/platform/doc-renderer";
17-
import { getBreadcrumbsFromUrl, getDocPageForSlug } from "@/app/docs/docs-data/data";
18-
import { ThemeToggle } from "@/app/platform/theme-toggle";
19-
import { notFound } from "next/navigation";
3+
import {
4+
getDocPageForSlug,
5+
} from "@/app/docs/docs-data/data";
6+
import { notFound } from "next/navigation";
7+
import { Skeleton } from "@/components/ui/skeleton";
8+
import { Metadata } from "next";
9+
10+
export async function generateMetadata(
11+
{ params }: {
12+
params: Promise<{slug: string}>,
13+
}
14+
): Promise<Metadata> {
15+
const slug = (await params).slug
16+
17+
console.log({slug});
18+
19+
const page = getDocPageForSlug(slug);
20+
21+
return {
22+
title: page?.name ? `${page.name} - UI Builder` : "Documentation - UI Builder",
23+
description: page?.props["data-group"] ? `Learn about ${page.props["data-group"]} features of the UI Builder component.` : "Documentation - UI Builder",
24+
}
25+
}
2026

2127
export default async function DocPage({
22-
params,
23-
}: {
24-
params: Promise<{ slug: string }>;
25-
}){
26-
const { slug } = await params;
27-
const page = getDocPageForSlug(slug);
28-
if (!page) {
29-
notFound();
30-
}
31-
const breadcrumbs = getBreadcrumbsFromUrl(slug);
32-
const currentPath = `/docs/${slug}`;
33-
console.log({slug});
34-
return <SidebarProvider>
35-
<AppSidebar currentPath={currentPath} />
36-
<SidebarInset>
37-
<header className="flex h-16 shrink-0 items-center justify-between gap-2 border-b px-4">
38-
<SidebarTrigger className="-ml-1" />
39-
<Breadcrumb className="flex-1">
40-
<BreadcrumbList>
41-
<BreadcrumbItem className="hidden md:block">
42-
<BreadcrumbLink href={breadcrumbs.category.url}>
43-
{breadcrumbs.category.title}
44-
</BreadcrumbLink>
45-
</BreadcrumbItem>
46-
<BreadcrumbSeparator className="hidden md:block" />
47-
<BreadcrumbItem>
48-
<BreadcrumbPage>{breadcrumbs.page.title}</BreadcrumbPage>
49-
</BreadcrumbItem>
50-
</BreadcrumbList>
51-
</Breadcrumb>
52-
<ThemeToggle />
53-
</header>
54-
<Suspense fallback={<div>Loading...</div>}>
28+
params,
29+
}: {
30+
params: Promise<{ slug: string }>;
31+
}) {
32+
const { slug } = await params;
33+
const page = getDocPageForSlug(slug);
34+
if (!page) {
35+
notFound();
36+
}
37+
38+
return (
39+
<div className="flex-1 overflow-auto">
40+
<Suspense fallback={<DocSkeleton />}>
5541
<DocRenderer className="max-w-6xl mx-auto my-8" page={page} />
5642
</Suspense>
57-
</SidebarInset>
58-
</SidebarProvider>
59-
}
43+
</div>
44+
);
45+
}
46+
47+
function DocSkeleton() {
48+
return (
49+
<div className="flex-1 overflow-auto">
50+
<div className="max-w-6xl mx-auto my-8 flex flex-col gap-4">
51+
<Skeleton className="h-10 w-full" />
52+
<Skeleton className="h-96 w-full" />
53+
<Skeleton className="h-96 w-full" />
54+
</div>
55+
</div>
56+
);
57+
}

app/docs/docs-data/data.ts

Lines changed: 6 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,13 @@ import { QUICK_START_LAYER } from "@/app/docs/docs-data/docs-page-layers/quick-s
33
import { COMPONENT_REGISTRY_LAYER } from "@/app/docs/docs-data/docs-page-layers/component-registry";
44
import { FIELD_OVERRIDES_LAYER } from "@/app/docs/docs-data/docs-page-layers/field-overrides";
55
import { CUSTOM_COMPONENTS_LAYER } from "@/app/docs/docs-data/docs-page-layers/custom-components";
6-
import { CANVAS_EDITOR_LAYER } from "@/app/docs/docs-data/docs-page-layers/canvas-editor";
7-
import { PAGES_PANEL_LAYER } from "@/app/docs/docs-data/docs-page-layers/pages-panel";
8-
import { VARIABLES_PANEL_LAYER } from "@/app/docs/docs-data/docs-page-layers/variables-panel";
9-
import { PROPS_PANEL_LAYER } from "@/app/docs/docs-data/docs-page-layers/props-panel";
10-
import { APPEARANCE_PANEL_LAYER } from "@/app/docs/docs-data/docs-page-layers/appearance-panel";
11-
import { IMMUTABLE_PAGES_LAYER } from "@/app/docs/docs-data/docs-page-layers/immutable-pages";
126
import { PANEL_CONFIGURATION_LAYER } from "@/app/docs/docs-data/docs-page-layers/panel-configuration";
137
import { VARIABLES_LAYER } from "@/app/docs/docs-data/docs-page-layers/variables";
148
import { VARIABLE_BINDING_LAYER } from "@/app/docs/docs-data/docs-page-layers/variable-binding";
159
import { READ_ONLY_MODE_LAYER } from "@/app/docs/docs-data/docs-page-layers/read-only-mode";
16-
import { DATA_BINDING_LAYER } from "@/app/docs/docs-data/docs-page-layers/data-binding";
1710
import { LAYER_STRUCTURE_LAYER } from "@/app/docs/docs-data/docs-page-layers/layer-structure";
1811
import { PERSISTENCE_LAYER } from "@/app/docs/docs-data/docs-page-layers/persistence";
1912
import { RENDERING_PAGES_LAYER } from "@/app/docs/docs-data/docs-page-layers/rendering-pages";
20-
import { PAGE_THEMING_LAYER } from "@/app/docs/docs-data/docs-page-layers/page-theming";
21-
import { EDITOR_PANEL_CONFIG_LAYER } from "@/app/docs/docs-data/docs-page-layers/editor-panel-config";
22-
import { PROPS_PANEL_CUSTOMIZATION_LAYER } from "@/app/docs/docs-data/docs-page-layers/props-panel-customization";
2313

2414
export const DOCS_PAGES = [
2515
// Core
@@ -30,31 +20,19 @@ export const DOCS_PAGES = [
3020
COMPONENT_REGISTRY_LAYER,
3121
CUSTOM_COMPONENTS_LAYER,
3222
FIELD_OVERRIDES_LAYER,
33-
34-
// Editor Features
35-
CANVAS_EDITOR_LAYER,
36-
PAGES_PANEL_LAYER,
37-
IMMUTABLE_PAGES_LAYER,
38-
APPEARANCE_PANEL_LAYER,
39-
PROPS_PANEL_LAYER,
40-
VARIABLES_PANEL_LAYER,
4123
PANEL_CONFIGURATION_LAYER,
42-
EDITOR_PANEL_CONFIG_LAYER,
43-
PROPS_PANEL_CUSTOMIZATION_LAYER,
4424

4525
// Data & Variables
4626
VARIABLES_LAYER,
4727
VARIABLE_BINDING_LAYER,
4828
READ_ONLY_MODE_LAYER,
49-
DATA_BINDING_LAYER,
5029

5130
// Layout & Persistence
5231
LAYER_STRUCTURE_LAYER,
5332
PERSISTENCE_LAYER,
5433

5534
// Rendering
5635
RENDERING_PAGES_LAYER,
57-
PAGE_THEMING_LAYER,
5836

5937
] as const;
6038

@@ -89,58 +67,21 @@ export const MENU_DATA: DocPageNavItem[] = [
8967
title: "Component System",
9068
items: [
9169
{
92-
title: "Getting Started with Components",
70+
title: "Components Intro",
9371
url: "/docs/component-registry",
9472
},
9573
{
96-
title: "Creating Custom Components",
74+
title: "Custom Components",
9775
url: "/docs/custom-components",
9876
},
9977
{
100-
title: "Advanced Component Configuration",
78+
title: "Advanced Configuration",
10179
url: "/docs/field-overrides",
102-
}
103-
],
104-
},
105-
{
106-
title: "Editor Features",
107-
items: [
108-
{
109-
title: "Canvas Editor",
110-
url: "/docs/canvas-editor",
111-
},
112-
{
113-
title: "Pages Panel",
114-
url: "/docs/pages-panel",
115-
},
116-
{
117-
title: "Immutable Pages",
118-
url: "/docs/immutable-pages",
119-
},
120-
{
121-
title: "Appearance Panel",
122-
url: "/docs/appearance-panel",
123-
},
124-
{
125-
title: "Props Panel",
126-
url: "/docs/props-panel",
127-
},
128-
{
129-
title: "Variables Panel",
130-
url: "/docs/variables-panel",
13180
},
13281
{
13382
title: "Panel Configuration",
13483
url: "/docs/panel-configuration",
135-
},
136-
{
137-
title: "Editor Panel Config",
138-
url: "/docs/editor-panel-config",
139-
},
140-
{
141-
title: "Props Panel Customization",
142-
url: "/docs/props-panel-customization",
143-
},
84+
}
14485
],
14586
},
14687
{
@@ -155,13 +96,9 @@ export const MENU_DATA: DocPageNavItem[] = [
15596
url: "/docs/variable-binding",
15697
},
15798
{
158-
title: "Read Only Mode",
99+
title: "Editing Restrictions",
159100
url: "/docs/read-only-mode",
160101
},
161-
{
162-
title: "Data Binding",
163-
url: "/docs/data-binding",
164-
},
165102
],
166103
},
167104
{
@@ -184,10 +121,6 @@ export const MENU_DATA: DocPageNavItem[] = [
184121
title: "Rendering Pages",
185122
url: "/docs/rendering-pages",
186123
},
187-
{
188-
title: "Page Theming",
189-
url: "/docs/page-theming",
190-
},
191124
],
192125
}
193126
] as const;
@@ -228,7 +161,7 @@ export function getBreadcrumbsFromUrl(url: string) {
228161
url: "#"
229162
},
230163
page: {
231-
title: "Page",
164+
title: "Home",
232165
url: url
233166
}
234167
};

app/docs/docs-data/docs-page-layers/appearance-panel.ts

Lines changed: 0 additions & 83 deletions
This file was deleted.

0 commit comments

Comments
 (0)