-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic.tsx
More file actions
55 lines (52 loc) · 1.3 KB
/
Copy pathbasic.tsx
File metadata and controls
55 lines (52 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import type { ReactElement } from "react";
import {
createComponentRegistry,
registerDefaultHTMLComponents,
registerDefaultShadcnComponents,
UIProvider,
ViewRenderer,
} from "@osspkg/ui-react";
import type { ViewSchema } from "@osspkg/ui-core";
import "@osspkg/ui-react/styles.css";
const components = createComponentRegistry();
registerDefaultHTMLComponents(components);
registerDefaultShadcnComponents(components);
const schema: ViewSchema = {
protocolVersion: "1.0",
id: "welcome",
title: "Welcome",
regions: {
"top-header": [],
"left-panel": [],
"right-panel": [],
bottom: [],
content: [
{
id: "welcome-card",
component: "card",
layout: { row: 1, cols: 8, offset: 2 },
children: [
{
id: "title",
component: "h1",
layout: { row: 1, cols: 12 },
props: { text: "Welcome" },
},
{
id: "body",
component: "p",
layout: { row: 2, cols: 8, offset: 2 },
props: { text: "This view is rendered from a declarative schema." },
},
],
},
],
},
};
export function BasicExample(): ReactElement {
return (
<UIProvider components={components}>
<ViewRenderer schema={schema} />
</UIProvider>
);
}