-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCodeMirror.stories.tsx
More file actions
47 lines (40 loc) · 1.26 KB
/
CodeMirror.stories.tsx
File metadata and controls
47 lines (40 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import React from "react";
import { Meta, StoryFn } from "@storybook/react";
import { helpersArgTypes } from "../../../.storybook/helpers";
import { CodeEditor } from "./CodeMirror";
export default {
title: "Extensions/CodeEditor",
component: CodeEditor,
//parameters: { actions: { argTypesRegex: '^on.*' } },
argTypes: {
onChange: {
action: "value changed",
},
intent: {
...helpersArgTypes.exampleIntent,
},
},
} as Meta<typeof CodeEditor>;
let forcedUpdateKey = 0; // @see https://github.com/storybookjs/storybook/issues/13375#issuecomment-1291011856
const TemplateFull: StoryFn<typeof CodeEditor> = (args) => <CodeEditor {...args} key={++forcedUpdateKey} />;
export const BasicExample = TemplateFull.bind({});
BasicExample.args = {
name: "jsinput",
mode: "json",
defaultValue: '{ json: "true" }',
};
export const MarkdownWithToolbar = TemplateFull.bind({});
MarkdownWithToolbar.args = {
name: "mdinput",
mode: "markdown",
defaultValue: "**test me**",
useToolbar: true,
};
export const LinterExample = TemplateFull.bind({});
LinterExample.args = {
name: "lintinput",
defaultValue: "**test me**",
mode: "javascript",
useLinting: true,
autoFocus: true,
};