Skip to content

Commit 4d518ee

Browse files
authored
Merge pull request #234 from objectstack-ai/copilot/fix-loading-issue-docs
2 parents 1ce68bb + 8b1dea8 commit 4d518ee

File tree

9 files changed

+310
-56
lines changed

9 files changed

+310
-56
lines changed

apps/site/app/layout.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { RootProvider } from 'fumadocs-ui/provider/next';
22
import './global.css';
33
import '@object-ui/components/style.css';
44
import { Inter } from 'next/font/google';
5+
import { ObjectUIProvider } from '@/app/components/ObjectUIProvider';
56

67
const inter = Inter({
78
subsets: ['latin'],
@@ -11,7 +12,9 @@ export default function Layout({ children }: LayoutProps<'/'>) {
1112
return (
1213
<html lang="en" className={inter.className} suppressHydrationWarning>
1314
<body className="flex flex-col min-h-screen">
14-
<RootProvider>{children}</RootProvider>
15+
<RootProvider>
16+
<ObjectUIProvider>{children}</ObjectUIProvider>
17+
</RootProvider>
1518
</body>
1619
</html>
1720
);

content/docs/components/basic/sidebar.mdx

Lines changed: 280 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,75 @@ The Sidebar component provides a collapsible navigation sidebar for applications
1111

1212
<ComponentDemo
1313
schema={{
14-
type: 'sidebar',
15-
items: [
16-
{ label: 'Dashboard', icon: 'home', href: '/' },
17-
{ label: 'Projects', icon: 'folder', href: '/projects' },
18-
{ label: 'Team', icon: 'users', href: '/team' },
19-
{ label: 'Settings', icon: 'settings', href: '/settings' }
14+
type: 'sidebar-provider',
15+
body: [
16+
{
17+
type: 'sidebar',
18+
body: [
19+
{
20+
type: 'sidebar-content',
21+
body: [
22+
{
23+
type: 'sidebar-group',
24+
label: 'Menu',
25+
body: [
26+
{
27+
type: 'sidebar-menu',
28+
body: [
29+
{
30+
type: 'sidebar-menu-item',
31+
body: [
32+
{
33+
type: 'sidebar-menu-button',
34+
body: [{ type: 'text', content: 'Dashboard' }]
35+
}
36+
]
37+
},
38+
{
39+
type: 'sidebar-menu-item',
40+
body: [
41+
{
42+
type: 'sidebar-menu-button',
43+
body: [{ type: 'text', content: 'Projects' }]
44+
}
45+
]
46+
},
47+
{
48+
type: 'sidebar-menu-item',
49+
body: [
50+
{
51+
type: 'sidebar-menu-button',
52+
body: [{ type: 'text', content: 'Team' }]
53+
}
54+
]
55+
},
56+
{
57+
type: 'sidebar-menu-item',
58+
body: [
59+
{
60+
type: 'sidebar-menu-button',
61+
body: [{ type: 'text', content: 'Settings' }]
62+
}
63+
]
64+
}
65+
]
66+
}
67+
]
68+
}
69+
]
70+
}
71+
]
72+
},
73+
{
74+
type: 'sidebar-inset',
75+
body: [
76+
{
77+
type: 'div',
78+
className: 'p-4',
79+
body: [{ type: 'text', content: 'Main content area' }]
80+
}
81+
]
82+
}
2083
]
2184
}}
2285
title="Basic Sidebar"
@@ -26,20 +89,84 @@ The Sidebar component provides a collapsible navigation sidebar for applications
2689

2790
<ComponentDemo
2891
schema={{
29-
type: 'sidebar',
30-
groups: [
92+
type: 'sidebar-provider',
93+
body: [
3194
{
32-
title: 'Main',
33-
items: [
34-
{ label: 'Dashboard', icon: 'home', href: '/' },
35-
{ label: 'Analytics', icon: 'bar-chart', href: '/analytics' }
95+
type: 'sidebar',
96+
body: [
97+
{
98+
type: 'sidebar-content',
99+
body: [
100+
{
101+
type: 'sidebar-group',
102+
label: 'Main',
103+
body: [
104+
{
105+
type: 'sidebar-menu',
106+
body: [
107+
{
108+
type: 'sidebar-menu-item',
109+
body: [
110+
{
111+
type: 'sidebar-menu-button',
112+
body: [{ type: 'text', content: 'Dashboard' }]
113+
}
114+
]
115+
},
116+
{
117+
type: 'sidebar-menu-item',
118+
body: [
119+
{
120+
type: 'sidebar-menu-button',
121+
body: [{ type: 'text', content: 'Analytics' }]
122+
}
123+
]
124+
}
125+
]
126+
}
127+
]
128+
},
129+
{
130+
type: 'sidebar-group',
131+
label: 'Management',
132+
body: [
133+
{
134+
type: 'sidebar-menu',
135+
body: [
136+
{
137+
type: 'sidebar-menu-item',
138+
body: [
139+
{
140+
type: 'sidebar-menu-button',
141+
body: [{ type: 'text', content: 'Projects' }]
142+
}
143+
]
144+
},
145+
{
146+
type: 'sidebar-menu-item',
147+
body: [
148+
{
149+
type: 'sidebar-menu-button',
150+
body: [{ type: 'text', content: 'Team' }]
151+
}
152+
]
153+
}
154+
]
155+
}
156+
]
157+
}
158+
]
159+
}
36160
]
37161
},
38162
{
39-
title: 'Management',
40-
items: [
41-
{ label: 'Projects', icon: 'folder', href: '/projects' },
42-
{ label: 'Team', icon: 'users', href: '/team' }
163+
type: 'sidebar-inset',
164+
body: [
165+
{
166+
type: 'div',
167+
className: 'p-4',
168+
body: [{ type: 'text', content: 'Main content area' }]
169+
}
43170
]
44171
}
45172
]
@@ -51,13 +178,69 @@ The Sidebar component provides a collapsible navigation sidebar for applications
51178

52179
<ComponentDemo
53180
schema={{
54-
type: 'sidebar',
55-
collapsible: true,
56-
defaultCollapsed: false,
57-
items: [
58-
{ label: 'Home', icon: 'home', href: '/' },
59-
{ label: 'Files', icon: 'folder', href: '/files' },
60-
{ label: 'Settings', icon: 'settings', href: '/settings' }
181+
type: 'sidebar-provider',
182+
body: [
183+
{
184+
type: 'sidebar',
185+
collapsible: 'icon',
186+
body: [
187+
{
188+
type: 'sidebar-content',
189+
body: [
190+
{
191+
type: 'sidebar-group',
192+
body: [
193+
{
194+
type: 'sidebar-menu',
195+
body: [
196+
{
197+
type: 'sidebar-menu-item',
198+
body: [
199+
{
200+
type: 'sidebar-menu-button',
201+
body: [{ type: 'text', content: 'Home' }]
202+
}
203+
]
204+
},
205+
{
206+
type: 'sidebar-menu-item',
207+
body: [
208+
{
209+
type: 'sidebar-menu-button',
210+
body: [{ type: 'text', content: 'Files' }]
211+
}
212+
]
213+
},
214+
{
215+
type: 'sidebar-menu-item',
216+
body: [
217+
{
218+
type: 'sidebar-menu-button',
219+
body: [{ type: 'text', content: 'Settings' }]
220+
}
221+
]
222+
}
223+
]
224+
}
225+
]
226+
}
227+
]
228+
}
229+
]
230+
},
231+
{
232+
type: 'sidebar-inset',
233+
body: [
234+
{
235+
type: 'div',
236+
className: 'p-4',
237+
body: [
238+
{ type: 'sidebar-trigger' },
239+
{ type: 'text', content: 'Main content area' }
240+
]
241+
}
242+
]
243+
}
61244
]
62245
}}
63246
title="Collapsible Sidebar"
@@ -97,12 +280,80 @@ interface SidebarSchema {
97280

98281
<ComponentDemo
99282
schema={{
100-
type: 'sidebar',
101-
items: [
102-
{ label: 'Inbox', icon: 'inbox', href: '/inbox', badge: 12 },
103-
{ label: 'Drafts', icon: 'file-text', href: '/drafts', badge: 3 },
104-
{ label: 'Sent', icon: 'send', href: '/sent' },
105-
{ label: 'Trash', icon: 'trash', href: '/trash' }
283+
type: 'sidebar-provider',
284+
body: [
285+
{
286+
type: 'sidebar',
287+
body: [
288+
{
289+
type: 'sidebar-content',
290+
body: [
291+
{
292+
type: 'sidebar-group',
293+
body: [
294+
{
295+
type: 'sidebar-menu',
296+
body: [
297+
{
298+
type: 'sidebar-menu-item',
299+
body: [
300+
{
301+
type: 'sidebar-menu-button',
302+
body: [
303+
{ type: 'text', content: 'Inbox' },
304+
{ type: 'badge', content: '12', className: 'ml-auto' }
305+
]
306+
}
307+
]
308+
},
309+
{
310+
type: 'sidebar-menu-item',
311+
body: [
312+
{
313+
type: 'sidebar-menu-button',
314+
body: [
315+
{ type: 'text', content: 'Drafts' },
316+
{ type: 'badge', content: '3', className: 'ml-auto' }
317+
]
318+
}
319+
]
320+
},
321+
{
322+
type: 'sidebar-menu-item',
323+
body: [
324+
{
325+
type: 'sidebar-menu-button',
326+
body: [{ type: 'text', content: 'Sent' }]
327+
}
328+
]
329+
},
330+
{
331+
type: 'sidebar-menu-item',
332+
body: [
333+
{
334+
type: 'sidebar-menu-button',
335+
body: [{ type: 'text', content: 'Trash' }]
336+
}
337+
]
338+
}
339+
]
340+
}
341+
]
342+
}
343+
]
344+
}
345+
]
346+
},
347+
{
348+
type: 'sidebar-inset',
349+
body: [
350+
{
351+
type: 'div',
352+
className: 'p-4',
353+
body: [{ type: 'text', content: 'Main content area' }]
354+
}
355+
]
356+
}
106357
]
107358
}}
108359
title="Sidebar with Badges"

content/docs/components/complex/table.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ import { ComponentDemo, DemoGrid } from '@/app/components/ComponentDemo';
1212
type: "table",
1313
columns: [
1414
{
15-
key: "name",
16-
title: "Name"
15+
header: "Name",
16+
accessorKey: "name"
1717
},
1818
{
19-
key: "email",
20-
title: "Email"
19+
header: "Email",
20+
accessorKey: "email"
2121
}
2222
],
2323
data: [
@@ -39,7 +39,7 @@ import { ComponentDemo, DemoGrid } from '@/app/components/ComponentDemo';
3939
```typescript
4040
interface TableSchema {
4141
type: 'table';
42-
columns: Array<{ key: string; title: string }>;
42+
columns: Array<{ header: string; accessorKey: string }>;
4343
data: Record<string, any>[];
4444
}
4545
```

packages/components/src/renderers/data-display/table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
} from '../../ui/table';
2020
import { cn } from '../../lib/utils';
2121

22-
export const SimpleTableRenderer = ({ schema, className, ..._props }: any) => {
22+
export const SimpleTableRenderer = ({ schema, className }: any) => {
2323
const data = useDataScope(schema.bind);
2424
const columns = schema.props?.columns || [];
2525

0 commit comments

Comments
 (0)