/
funnel.stories.tsx
65 lines (60 loc) · 1.57 KB
/
funnel.stories.tsx
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { withKnobs } from '@storybook/addon-knobs'
import { storiesOf } from '@storybook/react'
import { ResponsiveFunnel } from '../src'
const commonProps = {
data: [
{
id: 'step_sent',
value: 85523,
label: 'Sent',
},
{
id: 'step_viewed',
value: 74844,
label: 'Viewed',
},
{
id: 'step_clicked',
value: 62617,
label: 'Clicked',
},
{
id: 'step_add_to_card',
value: 50425,
label: 'Add To Card',
},
{
id: 'step_purchased',
value: 31139,
label: 'Purchased',
},
],
margin: { top: 20, right: 20, bottom: 20, left: 20 },
borderWidth: 20,
motionConfig: 'wobbly',
}
const stories = storiesOf('Funnel', module)
stories.addDecorator(withKnobs)
stories.add('custom tooltip', () => (
<div style={{ width: 900, height: 300 }}>
<ResponsiveFunnel
{...commonProps}
direction={'horizontal'}
tooltip={({ part }) => (
<div
style={{
padding: 12,
color: '#fff',
background: '#222222',
}}
>
<span>Look, I'm custom :)</span>
<br />
<strong>
{part.data.id}: {part.formattedValue}
</strong>
</div>
)}
/>
</div>
))