-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ed972b
commit 4bc93cb
Showing
3 changed files
with
80 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,123 +1,68 @@ | ||
import * as React from "react"; | ||
import { ComponentDemo } from "../../components/ComponentDemo"; | ||
import { Title } from "../../../components/typography/Title"; | ||
import { Card } from "../../../components/card/Card"; | ||
import { Code } from "../../../components/typography/Code"; | ||
import { PropsTable } from "../../components/PropsTable"; | ||
import { SchemaEditor } from "../../../components/editor/SchemaEditor"; | ||
|
||
export const SchemaEditorPage = () => { | ||
const schemaEditorProps = [ | ||
{ | ||
name: "initialData", | ||
type: "FormData", | ||
description: "Initial schema data to populate the editor", | ||
}, | ||
{ | ||
name: "onSubmit", | ||
type: "(schema: JsonSchema) => void", | ||
description: "Callback when schema is submitted", | ||
}, | ||
{ | ||
name: "onValidationChange", | ||
type: "(isValid: boolean) => void", | ||
description: "Callback when validation status changes", | ||
}, | ||
]; | ||
|
||
return ( | ||
<div className="space-y-12"> | ||
<div> | ||
<Title level={1}>Schema Editor</Title> | ||
<p className="mt-2 text-gray-400"> | ||
A powerful visual editor for creating and managing Verifiable Credential schemas. | ||
A visual editor for creating and managing JSON schemas. | ||
</p> | ||
</div> | ||
|
||
<Card> | ||
<Card.Header> | ||
<Title level={2}>Overview</Title> | ||
</Card.Header> | ||
<Card.Content> | ||
<p className="text-gray-400"> | ||
The Schema Editor provides both a form-based and JSON editor interface for creating | ||
JSON-LD compatible credential templates. It includes real-time preview and validation | ||
to ensure your schemas are compatible with Verifiable Credentials standards. | ||
</p> | ||
</Card.Content> | ||
</Card> | ||
|
||
<Card> | ||
<Card.Header> | ||
<Title level={2}>Installation</Title> | ||
</Card.Header> | ||
<Card.Content> | ||
<div className="space-y-2"> | ||
<p className="text-gray-400 mb-2"> | ||
The Schema Editor is included in the main package: | ||
</p> | ||
<Code> | ||
npm install av1-c | ||
</Code> | ||
</div> | ||
</Card.Content> | ||
</Card> | ||
|
||
<Card> | ||
<Card.Header> | ||
<Title level={2}>Basic Usage</Title> | ||
</Card.Header> | ||
<Card.Content> | ||
<section> | ||
<Title level={3}>Usage</Title> | ||
<div className="mt-4"> | ||
<ComponentDemo | ||
code={`import { SchemaEditor } from 'av1-c'; | ||
function MySchemaBuilder() { | ||
return ( | ||
<div className="container mx-auto"> | ||
<SchemaEditor /> | ||
</div> | ||
<SchemaEditor | ||
onSubmit={(schema) => { | ||
console.log('Schema created:', schema); | ||
}} | ||
/> | ||
); | ||
}`} | ||
/> | ||
</Card.Content> | ||
</Card> | ||
|
||
<Card> | ||
<Card.Header> | ||
<Title level={2}>Features</Title> | ||
</Card.Header> | ||
<Card.Content> | ||
<div className="grid grid-cols-1 md:grid-cols-2 gap-8"> | ||
<div className="space-y-4"> | ||
<h3 className="text-lg font-semibold text-gray-200">Field Types</h3> | ||
<ul className="list-disc list-inside text-gray-400 space-y-2"> | ||
<li>String</li> | ||
<li>Number</li> | ||
<li>Boolean</li> | ||
<li>Object</li> | ||
<li>Array</li> | ||
</ul> | ||
</div> | ||
<div className="space-y-4"> | ||
<h3 className="text-lg font-semibold text-gray-200">Capabilities</h3> | ||
<ul className="list-disc list-inside text-gray-400 space-y-2"> | ||
<li>Visual form builder</li> | ||
<li>JSON-LD context management</li> | ||
<li>Live preview with normalization</li> | ||
<li>Dark mode support</li> | ||
<li>TypeScript integration</li> | ||
</ul> | ||
> | ||
<div className="w-full"> | ||
<SchemaEditor | ||
onSubmit={(schema) => console.log('Schema created:', schema)} | ||
/> | ||
</div> | ||
</div> | ||
</Card.Content> | ||
</Card> | ||
</ComponentDemo> | ||
</div> | ||
</section> | ||
|
||
<Card> | ||
<Card.Header> | ||
<Title level={2}>Advanced Features</Title> | ||
</Card.Header> | ||
<Card.Content> | ||
<div className="space-y-4"> | ||
<h3 className="text-lg font-semibold text-gray-200">Field Properties</h3> | ||
<ul className="list-disc list-inside text-gray-400 space-y-2"> | ||
<li>Nested objects and arrays</li> | ||
<li>Field descriptions and comments</li> | ||
<li>Required field validation</li> | ||
<li>Example values</li> | ||
<li>JSON-LD context mapping</li> | ||
</ul> | ||
|
||
<div className="mt-6 p-4 bg-blue-500/10 border border-blue-500/30 rounded"> | ||
<h4 className="text-blue-300 font-medium mb-2">Pro Tip</h4> | ||
<p className="text-gray-400"> | ||
Use the JSON-LD normalization preview to ensure your credential template is compatible with | ||
Verifiable Credentials standards. The preview will show a green indicator when your schema | ||
is valid and can be properly normalized. | ||
</p> | ||
</div> | ||
</div> | ||
</Card.Content> | ||
</Card> | ||
<section> | ||
<Title level={3}>Properties</Title> | ||
<div className="mt-4"> | ||
<PropsTable props={schemaEditorProps} /> | ||
</div> | ||
</section> | ||
</div> | ||
); | ||
}; |