11import * as React from "react" ;
22import { ComponentDemo } from "../../components/ComponentDemo" ;
33import { Title } from "../../../components/typography/Title" ;
4- import { Card } from "../../../ components/card/Card " ;
5- import { Code } from "../../../components/typography/Code " ;
4+ import { PropsTable } from "../../components/PropsTable " ;
5+ import { SchemaEditor } from "../../../components/editor/SchemaEditor " ;
66
77export const SchemaEditorPage = ( ) => {
8+ const schemaEditorProps = [
9+ {
10+ name : "initialData" ,
11+ type : "FormData" ,
12+ description : "Initial schema data to populate the editor" ,
13+ } ,
14+ {
15+ name : "onSubmit" ,
16+ type : "(schema: JsonSchema) => void" ,
17+ description : "Callback when schema is submitted" ,
18+ } ,
19+ {
20+ name : "onValidationChange" ,
21+ type : "(isValid: boolean) => void" ,
22+ description : "Callback when validation status changes" ,
23+ } ,
24+ ] ;
25+
826 return (
927 < div className = "space-y-12" >
1028 < div >
1129 < Title level = { 1 } > Schema Editor</ Title >
1230 < p className = "mt-2 text-gray-400" >
13- A powerful visual editor for creating and managing Verifiable Credential schemas.
31+ A visual editor for creating and managing JSON schemas.
1432 </ p >
1533 </ div >
1634
17- < Card >
18- < Card . Header >
19- < Title level = { 2 } > Overview</ Title >
20- </ Card . Header >
21- < Card . Content >
22- < p className = "text-gray-400" >
23- The Schema Editor provides both a form-based and JSON editor interface for creating
24- JSON-LD compatible credential templates. It includes real-time preview and validation
25- to ensure your schemas are compatible with Verifiable Credentials standards.
26- </ p >
27- </ Card . Content >
28- </ Card >
29-
30- < Card >
31- < Card . Header >
32- < Title level = { 2 } > Installation</ Title >
33- </ Card . Header >
34- < Card . Content >
35- < div className = "space-y-2" >
36- < p className = "text-gray-400 mb-2" >
37- The Schema Editor is included in the main package:
38- </ p >
39- < Code >
40- npm install av1-c
41- </ Code >
42- </ div >
43- </ Card . Content >
44- </ Card >
45-
46- < Card >
47- < Card . Header >
48- < Title level = { 2 } > Basic Usage</ Title >
49- </ Card . Header >
50- < Card . Content >
35+ < section >
36+ < Title level = { 3 } > Usage</ Title >
37+ < div className = "mt-4" >
5138 < ComponentDemo
5239 code = { `import { SchemaEditor } from 'av1-c';
5340
5441function MySchemaBuilder() {
5542 return (
56- <div className="container mx-auto">
57- <SchemaEditor />
58- </div>
43+ <SchemaEditor
44+ onSubmit={(schema) => {
45+ console.log('Schema created:', schema);
46+ }}
47+ />
5948 );
6049}` }
61- />
62- </ Card . Content >
63- </ Card >
64-
65- < Card >
66- < Card . Header >
67- < Title level = { 2 } > Features</ Title >
68- </ Card . Header >
69- < Card . Content >
70- < div className = "grid grid-cols-1 md:grid-cols-2 gap-8" >
71- < div className = "space-y-4" >
72- < h3 className = "text-lg font-semibold text-gray-200" > Field Types</ h3 >
73- < ul className = "list-disc list-inside text-gray-400 space-y-2" >
74- < li > String</ li >
75- < li > Number</ li >
76- < li > Boolean</ li >
77- < li > Object</ li >
78- < li > Array</ li >
79- </ ul >
80- </ div >
81- < div className = "space-y-4" >
82- < h3 className = "text-lg font-semibold text-gray-200" > Capabilities</ h3 >
83- < ul className = "list-disc list-inside text-gray-400 space-y-2" >
84- < li > Visual form builder</ li >
85- < li > JSON-LD context management</ li >
86- < li > Live preview with normalization</ li >
87- < li > Dark mode support</ li >
88- < li > TypeScript integration</ li >
89- </ ul >
50+ >
51+ < div className = "w-full" >
52+ < SchemaEditor
53+ onSubmit = { ( schema ) => console . log ( 'Schema created:' , schema ) }
54+ />
9055 </ div >
91- </ div >
92- </ Card . Content >
93- </ Card >
56+ </ ComponentDemo >
57+ </ div >
58+ </ section >
9459
95- < Card >
96- < Card . Header >
97- < Title level = { 2 } > Advanced Features</ Title >
98- </ Card . Header >
99- < Card . Content >
100- < div className = "space-y-4" >
101- < h3 className = "text-lg font-semibold text-gray-200" > Field Properties</ h3 >
102- < ul className = "list-disc list-inside text-gray-400 space-y-2" >
103- < li > Nested objects and arrays</ li >
104- < li > Field descriptions and comments</ li >
105- < li > Required field validation</ li >
106- < li > Example values</ li >
107- < li > JSON-LD context mapping</ li >
108- </ ul >
109-
110- < div className = "mt-6 p-4 bg-blue-500/10 border border-blue-500/30 rounded" >
111- < h4 className = "text-blue-300 font-medium mb-2" > Pro Tip</ h4 >
112- < p className = "text-gray-400" >
113- Use the JSON-LD normalization preview to ensure your credential template is compatible with
114- Verifiable Credentials standards. The preview will show a green indicator when your schema
115- is valid and can be properly normalized.
116- </ p >
117- </ div >
118- </ div >
119- </ Card . Content >
120- </ Card >
60+ < section >
61+ < Title level = { 3 } > Properties</ Title >
62+ < div className = "mt-4" >
63+ < PropsTable props = { schemaEditorProps } />
64+ </ div >
65+ </ section >
12166 </ div >
12267 ) ;
12368} ;
0 commit comments