This commit is contained in:
Nathan Bierema 2020-08-31 23:42:31 -04:00
parent f56da227ca
commit 1c68a52202
4 changed files with 75 additions and 72 deletions

View File

@ -20,6 +20,12 @@ Default.args = {
fullWidth: false,
children: 'Hello Dialog!',
};
Default.argTypes = {
actions: { table: { disable: true } },
onDismiss: { table: { disable: true } },
onSubmit: { table: { disable: true } },
theme: { table: { disable: true } },
};
export const WithForm = Template.bind({});
WithForm.args = {
@ -32,35 +38,12 @@ WithForm.args = {
schema,
uiSchema,
};
// storiesOf('Dialog', module)
// .addDecorator(withKnobs)
// .add('default', () => (
// <Dialog
// title={text('title', 'Dialog Title')}
// submitText={text('submitText', 'Submit!')}
// open={boolean('open', true)}
// noHeader={boolean('noHeader', false)}
// noFooter={boolean('noFooter', false)}
// modal={boolean('modal', false)}
// fullWidth={boolean('fullWidth', false)}
// onDismiss={action('dialog dismissed')}
// onSubmit={action('dialog submitted')}
// >
// {text('children', 'Hello Dialog!')}
// </Dialog>
// ))
// .add('with form', () => (
// <Dialog
// open={boolean('open', true)}
// noHeader={boolean('noHeader', false)}
// noFooter={boolean('noFooter', false)}
// fullWidth={boolean('fullWidth', false)}
// submitText={text('submitText', 'Submit!')}
// formData={object('formData', formData)}
// schema={object('schema', schema)}
// uiSchema={object('uiSchema', uiSchema)}
// onChange={action('form changed')}
// onSubmit={action('form submitted')}
// onDismiss={action('dialog dismissed')}
// />
// ));
WithForm.argTypes = {
title: { table: { disable: true } },
children: { table: { disable: true } },
actions: { table: { disable: true } },
modal: { table: { disable: true } },
onDismiss: { table: { disable: true } },
onSubmit: { table: { disable: true } },
theme: { table: { disable: true } },
};

View File

@ -0,0 +1,56 @@
import React from 'react';
import Editor from './';
import { default as WithTabsComponent } from './WithTabs';
const value = `
var themes = [];
function getThemes() {
return themes;
}
`;
export default {
title: 'Editor',
component: Editor,
};
const Template = (args) => <Editor {...args} />;
export const Default = Template.bind({});
Default.args = {
value,
lineNumbers: true,
lineWrapping: false,
foldGutter: true,
readOnly: false,
autofocus: true,
};
const WithTabsTemplate = (args) => <WithTabsComponent {...args} />;
export const WithTabs = WithTabsTemplate.bind({});
WithTabs.args = {
lineNumbers: true,
align: 'left',
};
// storiesOf('Editor', module)
// .addDecorator(withKnobs)
// .add(
// 'default',
// () => (
// <Editor
// value={text('value', value)}
// lineNumbers={boolean('lineNumbers', true)}
// lineWrapping={boolean('lineWrapping', false)}
// foldGutter={boolean('foldGutter', true)}
// readOnly={boolean('readOnly', false)}
// onChange={action('change')}
// autofocus
// />
// ),
// { info: 'Based on [CodeMirror](http://codemirror.net/).' }
// )
// .add('with tabs', () => (
// <WithTabs lineNumbers={boolean('lineNumbers', true)} />
// ));

View File

@ -1,7 +1,6 @@
import React, { Component } from 'react';
import { select } from '@storybook/addon-knobs';
import Editor from '../';
import Tabs from '../../Tabs';
import Editor from './';
import Tabs from '../Tabs';
const value1 = `
const func1 = () => {}
@ -18,7 +17,7 @@ export default class WithTabs extends Component {
};
render() {
const { lineNumbers } = this.props;
const { align, lineNumbers } = this.props;
return (
<Tabs
tabs={[
@ -37,7 +36,7 @@ export default class WithTabs extends Component {
onClick={(selected) => {
this.setState({ selected });
}}
align={select('align', ['left', 'right', 'center'], 'left')}
align={align}
/>
);
}

View File

@ -1,35 +0,0 @@
import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { withKnobs, text, boolean } from '@storybook/addon-knobs';
import Editor from '../';
import WithTabs from './WithTabs';
const value = `
var themes = [];
function getThemes() {
return themes;
}
`;
storiesOf('Editor', module)
.addDecorator(withKnobs)
.add(
'default',
() => (
<Editor
value={text('value', value)}
lineNumbers={boolean('lineNumbers', true)}
lineWrapping={boolean('lineWrapping', false)}
foldGutter={boolean('foldGutter', true)}
readOnly={boolean('readOnly', false)}
onChange={action('change')}
autofocus
/>
),
{ info: 'Based on [CodeMirror](http://codemirror.net/).' }
)
.add('with tabs', () => (
<WithTabs lineNumbers={boolean('lineNumbers', true)} />
));