diff --git a/src/docs/App.tsx b/src/docs/App.tsx index 2276083..89f65e0 100644 --- a/src/docs/App.tsx +++ b/src/docs/App.tsx @@ -31,6 +31,7 @@ import { AccordionPage } from "./pages/components/AccordionPage"; import { CodeEditorPage } from "./pages/components/CodeEditorPage"; import { FeaturesPage } from "./pages/FeaturesPage"; import { Toaster } from 'react-hot-toast'; +import { SchemaEditorPage } from "./pages/features/SchemaEditorPage"; export const App = () => { const [currentPage, setCurrentPage] = React.useState(() => { @@ -115,6 +116,8 @@ export const App = () => { return ; case "code-editor": return ; + case "schema-editor": + return ; default: return ; } diff --git a/src/docs/components/Navigation.tsx b/src/docs/components/Navigation.tsx index 9167825..c27d28b 100644 --- a/src/docs/components/Navigation.tsx +++ b/src/docs/components/Navigation.tsx @@ -20,6 +20,12 @@ export const Navigation: React.FC = ({ currentPage, onNavigate { id: "features", label: "Features" }, ], }, + { + title: "Features", + items: [ + { id: "schema-editor", label: "Schema Editor" }, + ], + }, { title: "Layout", items: [ @@ -45,7 +51,7 @@ export const Navigation: React.FC = ({ currentPage, onNavigate { id: "table", label: "Table" }, { id: "tooltip", label: "Tooltip" }, { id: "accordion", label: "Accordion" }, - { id: "code-editor", label: "Code Editor" }, + { id: "code-editor", label: "Code Editor" } ], }, { @@ -76,11 +82,14 @@ export const Navigation: React.FC = ({ currentPage, onNavigate const [searchQuery, setSearchQuery] = React.useState(""); - const filterItems = (items: Array<{ id: string; label: string }>) => { + const filterItems = (items: Array<{ id: string; label: string } | { title: string; href: string }>) => { if (!searchQuery) return items; - return items.filter(item => - item.label.toLowerCase().includes(searchQuery.toLowerCase()) - ); + return items.filter(item => { + if ('label' in item) { + return item.label.toLowerCase().includes(searchQuery.toLowerCase()); + } + return item.title.toLowerCase().includes(searchQuery.toLowerCase()); + }); }; const renderSection = (section: typeof sections[0]) => { @@ -89,21 +98,26 @@ export const Navigation: React.FC = ({ currentPage, onNavigate return (
    - {filteredItems.map((item) => ( -
  • - -
  • - ))} + {filteredItems.map((item) => { + const id = 'id' in item ? item.id : item.href; + const label = 'label' in item ? item.label : item.title; + + return ( +
  • + +
  • + ); + })}
); }; diff --git a/src/docs/pages/features/SchemaEditorPage.tsx b/src/docs/pages/features/SchemaEditorPage.tsx index cbabde1..7b65dd7 100644 --- a/src/docs/pages/features/SchemaEditorPage.tsx +++ b/src/docs/pages/features/SchemaEditorPage.tsx @@ -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 (
Schema Editor

- A powerful visual editor for creating and managing Verifiable Credential schemas. + A visual editor for creating and managing JSON schemas.

- - - Overview - - -

- 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. -

-
-
- - - - Installation - - -
-

- The Schema Editor is included in the main package: -

- - npm install av1-c - -
-
-
- - - - Basic Usage - - +
+ Usage +
- -
+ { + console.log('Schema created:', schema); + }} + /> ); }`} - /> - - - - - - Features - - -
-
-

Field Types

-
    -
  • String
  • -
  • Number
  • -
  • Boolean
  • -
  • Object
  • -
  • Array
  • -
-
-
-

Capabilities

-
    -
  • Visual form builder
  • -
  • JSON-LD context management
  • -
  • Live preview with normalization
  • -
  • Dark mode support
  • -
  • TypeScript integration
  • -
+ > +
+ console.log('Schema created:', schema)} + />
-
- - + +
+
- - - Advanced Features - - -
-

Field Properties

-
    -
  • Nested objects and arrays
  • -
  • Field descriptions and comments
  • -
  • Required field validation
  • -
  • Example values
  • -
  • JSON-LD context mapping
  • -
- -
-

Pro Tip

-

- 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. -

-
-
-
-
+
+ Properties +
+ +
+
); }; \ No newline at end of file