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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
import { observable } from 'mobx';
import { observer } from 'mobx-react';
import React from 'react';
import { Infobox } from '@meetfranz/ui';
import { storiesOf } from '../stores/stories';
interface IStoreArgs {
icon?: string;
ctaLabel?: string;
type?: string;
dismissable?: boolean;
}
const createStore = (args?: IStoreArgs) => {
return observable(Object.assign({
type: 'primary',
ctaOnClick: () => {
alert('on click handler');
},
}, args));
};
const WithStoreInfobox = observer(({ store, children }: { store: any, children: string | React.ReactNode }) => (
<>
<Infobox
icon={store.icon}
ctaLabel={store.ctaLabel}
type={store.type}
ctaOnClick={store.ctaOnClick}
dismissable={store.dismissable}
>
{children}
</Infobox>
</>
));
storiesOf('Infobox')
.add('Basic', () => (
<WithStoreInfobox store={createStore()}>Welcome to the world of tomorrow</WithStoreInfobox>
))
.add('Icon + Dismissable', () => (
<WithStoreInfobox
store={createStore({
icon: 'mdiEarth',
dismissable: true,
})}
>
Welcome to the world of tomorrow
</WithStoreInfobox>
))
.add('With CTA', () => (
<WithStoreInfobox
store={createStore({
icon: 'mdiEarth',
ctaLabel: 'Ok, hi!',
})}
>
Welcome to the world of tomorrow
</WithStoreInfobox>
))
.add('With long text', () => (
<WithStoreInfobox
store={createStore({
icon: 'mdiEarth',
ctaLabel: 'Ok, hi!',
})}
>
Franz is your messaging app / former Emperor of Austria and combines chat & messaging services into one application. Franz currently supports Slack, WhatsApp, WeChat, HipChat, Facebook Messenger, Telegram, Google Hangouts,GroupMe, Skype and many more.
</WithStoreInfobox>
))
.add('Secondary', () => (
<WithStoreInfobox
store={createStore({
icon: 'mdiEarth',
ctaLabel: 'Ok, hi!',
type: 'secondary',
})}
>
Welcome to the world of tomorrow
</WithStoreInfobox>
))
.add('Success', () => (
<WithStoreInfobox
store={createStore({
icon: 'mdiEarth',
ctaLabel: 'Ok, hi!',
type: 'success',
})}
>
Welcome to the world of tomorrow
</WithStoreInfobox>
))
.add('Warning', () => (
<WithStoreInfobox
store={createStore({
icon: 'mdiEarth',
ctaLabel: 'Ok, hi!',
type: 'warning',
})}
>
Welcome to the world of tomorrow
</WithStoreInfobox>
))
.add('Danger', () => (
<WithStoreInfobox
store={createStore({
icon: 'mdiEarth',
ctaLabel: 'Ok, hi!',
type: 'danger',
})}
>
Welcome to the world of tomorrow
</WithStoreInfobox>
))
.add('Inverted', () => (
<WithStoreInfobox
store={createStore({
icon: 'mdiEarth',
ctaLabel: 'Ok, hi!',
type: 'inverted',
})}
>
Welcome to the world of tomorrow
</WithStoreInfobox>
));
|