File tree Expand file tree Collapse file tree 2 files changed +34
-26
lines changed
plop-templates/@react-spectrum Expand file tree Collapse file tree 2 files changed +34
-26
lines changed Original file line number Diff line number Diff line change 11
11
*/
12
12
13
13
import { {{~ componentName ~}} } from '../';
14
+ import {Meta, Story} from '@storybook/react';
14
15
import React from 'react';
15
16
{{ #if (includes scopes " @react-types" )}}
16
17
import {Spectrum{{ componentName }} Props} from '@react-types/{{ packageName }} ';
17
18
{{ /if }}
18
- import {storiesOf} from '@storybook/react';
19
-
20
19
{{ #unless (includes scopes " @react-types" )}}
20
+
21
21
interface Spectrum{{ componentName }} Props {
22
22
23
23
}
24
24
{{ /unless }}
25
25
26
- storiesOf('{{ componentName }} ', module)
27
- .add(
28
- 'name me',
29
- () => render({})
30
- );
26
+ const meta: Meta<Spectrum {{ componentName }} Props> = {
27
+ title: '{{ componentName }} ',
28
+ component: {{ componentName }}
29
+ };
31
30
32
- function render(props: Spectrum{{ componentName }} Props = {}) {
33
- return (
34
- <{{componentName}} {...props} />
35
- );
36
- }
31
+ export default meta;
32
+
33
+ const Template = (): Story<Spectrum {{ componentName }} Props> => (args) => (
34
+ <{{componentName}} {...args}>This is a React Spectrum {{ componentName }} </{{componentName}} >
35
+ );
36
+
37
+ export const Default = Template().bind({});
38
+ Default.args = {};
Original file line number Diff line number Diff line change 11
11
*/
12
12
13
13
import {action} from '@storybook/addon-actions';
14
- {{ #if (includes scopes " @react-types" )}}
15
14
import { {{~ componentName ~}} } from '../';
15
+ import {Meta, Story} from '@storybook/react';
16
+ import React from 'react';
17
+ {{ #if (includes scopes " @react-types" )}}
16
18
import {Spectrum{{ componentName }} Props} from '@react-types/{{ packageName }} ';
17
- {{ else }}
18
- import { {{~ componentName }} , Spectrum{{ componentName }} Props} from '../';
19
19
{{ /if }}
20
- import React from 'react';
21
- import {storiesOf} from '@storybook/react';
20
+ {{ #unless (includes scopes " @react-types" )}}
22
21
23
- storiesOf('{{ componentName }} ', module)
24
- .add(
25
- 'name me',
26
- () => render({})
27
- );
22
+ interface Spectrum{{ componentName }} Props {
28
23
29
- function render(props: Spectrum{{ componentName }} Props) {
30
- return (
31
- <{{componentName}} {...props} onChange = {action(' onChange' )} />
32
- );
33
24
}
25
+ {{ /unless }}
26
+
27
+ const meta: Meta<Spectrum {{ componentName }} Props> = {
28
+ title: '{{ componentName }} ',
29
+ component: {{ componentName }}
30
+ };
31
+
32
+ export default meta;
33
+
34
+ const Template = (): Story<Spectrum {{ componentName }} Props> => (args) => (
35
+ <{{componentName}} {...args}>This is a React Spectrum {{ componentName }} </{{componentName}} >
36
+ );
37
+
38
+ export const Default = Template().bind({});
39
+ Default.args = {onChange: action('onChange')};
You can’t perform that action at this time.
0 commit comments