Skip to content

Commit 2556454

Browse files
committed
adjust salespath story as csf3
1 parent c1272b4 commit 2556454

File tree

1 file changed

+55
-38
lines changed

1 file changed

+55
-38
lines changed

stories/SalesPath.stories.tsx

Lines changed: 55 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,68 @@
11
import React from 'react';
2-
import { action } from '@storybook/addon-actions';
3-
import { select } from '@storybook/addon-knobs';
42
import { SalesPath } from '../src/scripts';
5-
export default {
3+
import { ComponentMeta, ComponentStoryObj } from '@storybook/react';
4+
5+
/**
6+
*
7+
*/
8+
const meta: ComponentMeta<typeof SalesPath> = {
69
title: 'SalesPath',
10+
component: SalesPath,
11+
subcomponents: { SalesPathItem: SalesPath.PathItem },
12+
argTypes: {
13+
onSelect: { action: 'select' },
14+
},
715
};
8-
export const ControlledWithKnobs = {
9-
render: () => {
10-
const activeKey = select(
11-
'activeKey',
12-
{
13-
1: '1',
14-
2: '2',
15-
3: '3',
16-
4: '4',
17-
5: '5',
16+
export default meta;
17+
18+
/**
19+
*
20+
*/
21+
export const ControlledWithKnobs: ComponentStoryObj<typeof SalesPath> = {
22+
render: (args) => (
23+
<SalesPath {...args}>
24+
<SalesPath.PathItem eventKey='1' title='Contacted' />
25+
<SalesPath.PathItem eventKey='2' title='Open' />
26+
<SalesPath.PathItem eventKey='3' title='Unqualified' />
27+
<SalesPath.PathItem eventKey='4' title='Nurturing' />
28+
<SalesPath.PathItem eventKey='5' title='Closed' />
29+
</SalesPath>
30+
),
31+
name: 'Controlled with knobs',
32+
args: {
33+
activeKey: '1',
34+
},
35+
argTypes: {
36+
activeKey: {
37+
control: {
38+
type: 'select',
39+
options: ['1', '2', '3', '4', '5'],
1840
},
19-
'1'
20-
);
21-
return (
22-
<SalesPath activeKey={activeKey} onSelect={action('onSelect')}>
23-
<SalesPath.PathItem eventKey='1' title='Contacted' />
24-
<SalesPath.PathItem eventKey='2' title='Open' />
25-
<SalesPath.PathItem eventKey='3' title='Unqualified' />
26-
<SalesPath.PathItem eventKey='4' title='Nurturing' />
27-
<SalesPath.PathItem eventKey='5' title='Closed' />
28-
</SalesPath>
29-
);
41+
},
3042
},
31-
name: 'Controlled with knobs',
3243
parameters: {
33-
info: 'Sales Path controlled with knobs',
44+
docs: {
45+
description: {
46+
story: 'Sales Path controlled with knobs',
47+
},
48+
},
3449
},
3550
};
36-
export const Default = {
37-
render: () => {
38-
return (
39-
<SalesPath activeKey='3' onSelect={action('onSelect')}>
40-
<SalesPath.PathItem eventKey='1' title='Contacted' />
41-
<SalesPath.PathItem eventKey='2' title='Open' />
42-
<SalesPath.PathItem eventKey='3' title='Unqualified' />
43-
<SalesPath.PathItem eventKey='4' title='Nurturing' />
44-
<SalesPath.PathItem eventKey='5' title='Closed' />
45-
</SalesPath>
46-
);
51+
52+
/**
53+
*
54+
*/
55+
export const Default: ComponentStoryObj<typeof SalesPath> = {
56+
...ControlledWithKnobs,
57+
name: 'Default',
58+
args: {
59+
activeKey: '3',
4760
},
4861
parameters: {
49-
info: 'Sales Path',
62+
docs: {
63+
description: {
64+
story: 'Sales Path',
65+
},
66+
},
5067
},
5168
};

0 commit comments

Comments
 (0)