From dc3fff36c4ad627fffe1df3efb9c9227ca33ca22 Mon Sep 17 00:00:00 2001 From: Prince Rajpoot Date: Tue, 9 Jan 2024 22:10:05 +0530 Subject: [PATCH] added more sample schema --- .../src/components/visualeditor.stories.tsx | 283 ++++++++++++++---- 1 file changed, 224 insertions(+), 59 deletions(-) diff --git a/apps/design-system/src/components/visualeditor.stories.tsx b/apps/design-system/src/components/visualeditor.stories.tsx index 4e54f8aba..2a3baa2b2 100644 --- a/apps/design-system/src/components/visualeditor.stories.tsx +++ b/apps/design-system/src/components/visualeditor.stories.tsx @@ -1,83 +1,248 @@ +// visualeditor.stories.tsx import React, { useState } from 'react'; -import { VisualEditor, CodeEditor, Examples } from '@asyncapi/studio-ui'; +import { VisualEditor, CodeEditor} from '@asyncapi/studio-ui'; +import { Examples } from '@asyncapi/studio-ui'; -const meta = { +export default { + title: 'SchemaEditor/VisualEditor', component: VisualEditor, parameters: { layout: 'fullscreen', - backgrounds: { - default: 'light' - } }, }; -export default meta; - -const EditorToggle: React.FC<{ schema: string; onSchemaChange: (schema: string) => void }> = ({ schema, onSchemaChange }) => { - const [activeSystem, setActiveSystem] = useState('vis'); - - const handleSystemClick = (systemKey: string) => { - setActiveSystem(systemKey); - }; +const Template = ({ initialSchema }) => { + const [schema, setSchema] = useState(initialSchema); + const [editorType, setEditorType] = useState('visual'); return ( -
-
- - - +
+
+ + + +
+
+ {editorType === 'visual' && ( + + )} + {editorType === 'code' && ( + + )} + {editorType === 'examples' && ( + + )}
- {activeSystem === 'vis' && } - {activeSystem === 'code' && } - {activeSystem === 'ex' && }
); }; -export const DefaultSchema = () => { - const [schema, setSchema] = useState('{}'); - - return ; -}; +export const DefaultView = () =>