From 39cd54c889e57bf95c25cb8a9a4319e1544f0ce2 Mon Sep 17 00:00:00 2001 From: NicoLaval Date: Mon, 16 Oct 2023 05:49:13 +0200 Subject: [PATCH] Add initialRule arg for stories --- src/stories/VtlEditor.stories.ts | 11 ++++++++++- src/stories/VtlEditor.tsx | 6 +++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/stories/VtlEditor.stories.ts b/src/stories/VtlEditor.stories.ts index f566f8b..6670c4c 100644 --- a/src/stories/VtlEditor.stories.ts +++ b/src/stories/VtlEditor.stories.ts @@ -6,16 +6,23 @@ export default { tags: ["autodocs"] }; -export const Default = {}; +export const Default = { + args: { initialRule: "start" }, + argTypes: { + initialRule: { control: "select", options: ["start", "expr"] } + } +}; export const Styled = { args: { + initialRule: "start", theme: "vs-dark", height: "50vh", width: "80%", options: { lineNumbers: true, minimap: { enabled: true }, readOnly: false } }, argTypes: { + initialRule: { control: "select", options: ["start", "expr"] }, theme: { control: "select", options: ["vs-dark", "vs-light"] }, options: { control: "object" } } @@ -41,6 +48,7 @@ const variables = { export const Enriched = { args: { + initialRule: "start", variables, variablesInputURLs: [ "https://raw.githubusercontent.com/Making-Sense-Info/ANTLR-Editor/gh-pages/samples/variablesInputFile1.json", @@ -48,6 +56,7 @@ export const Enriched = { ] }, argTypes: { + initialRule: { control: "select", options: ["start", "expr"] }, variables: { control: "object" }, variablesInputURLs: { control: "object" } } diff --git a/src/stories/VtlEditor.tsx b/src/stories/VtlEditor.tsx index 1ed0805..2668562 100644 --- a/src/stories/VtlEditor.tsx +++ b/src/stories/VtlEditor.tsx @@ -4,6 +4,10 @@ import { getSuggestionsFromRange, monarchDefinition } from "./vtl-monaco"; const customTools = { ...tools, getSuggestionsFromRange, monarchDefinition }; -const EditorForStories = (props: any) => ; +const EditorForStories = (props: any) => { + const { initialRule = "start" } = props; + console.log(initialRule); + return ; +}; export default EditorForStories;