diff options
Diffstat (limited to 'uidev/src/stories/infobox.stories.tsx')
-rw-r--r-- | uidev/src/stories/infobox.stories.tsx | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/uidev/src/stories/infobox.stories.tsx b/uidev/src/stories/infobox.stories.tsx new file mode 100644 index 000000000..144855376 --- /dev/null +++ b/uidev/src/stories/infobox.stories.tsx | |||
@@ -0,0 +1,135 @@ | |||
1 | import { observable } from 'mobx'; | ||
2 | import { observer } from 'mobx-react'; | ||
3 | import React from 'react'; | ||
4 | |||
5 | import { Infobox } from '@meetfranz/ui'; | ||
6 | import { storiesOf } from '../stores/stories'; | ||
7 | |||
8 | interface IStoreArgs { | ||
9 | icon?: string; | ||
10 | ctaLabel?: string; | ||
11 | type?: string; | ||
12 | dismissable?: boolean; | ||
13 | className?: string; | ||
14 | } | ||
15 | |||
16 | const createStore = (args?: IStoreArgs) => { | ||
17 | return observable(Object.assign({ | ||
18 | type: 'primary', | ||
19 | ctaOnClick: () => { | ||
20 | alert('on click handler'); | ||
21 | }, | ||
22 | }, args)); | ||
23 | }; | ||
24 | |||
25 | const WithStoreInfobox = observer(({ store, children }: { store: any, children: string | React.ReactNode }) => ( | ||
26 | <> | ||
27 | <Infobox | ||
28 | icon={store.icon} | ||
29 | ctaLabel={store.ctaLabel} | ||
30 | type={store.type} | ||
31 | ctaOnClick={store.ctaOnClick} | ||
32 | dismissable={store.dismissable} | ||
33 | className={store.className} | ||
34 | > | ||
35 | {children} | ||
36 | </Infobox> | ||
37 | </> | ||
38 | )); | ||
39 | |||
40 | storiesOf('Infobox') | ||
41 | .add('Basic', () => ( | ||
42 | <WithStoreInfobox store={createStore()}>Welcome to the world of tomorrow</WithStoreInfobox> | ||
43 | )) | ||
44 | .add('Icon + Dismissable', () => ( | ||
45 | <WithStoreInfobox | ||
46 | store={createStore({ | ||
47 | icon: 'mdiEarth', | ||
48 | dismissable: true, | ||
49 | })} | ||
50 | > | ||
51 | Welcome to the world of tomorrow | ||
52 | </WithStoreInfobox> | ||
53 | )) | ||
54 | .add('With CTA', () => ( | ||
55 | <WithStoreInfobox | ||
56 | store={createStore({ | ||
57 | icon: 'mdiEarth', | ||
58 | ctaLabel: 'Ok, hi!', | ||
59 | })} | ||
60 | > | ||
61 | Welcome to the world of tomorrow | ||
62 | </WithStoreInfobox> | ||
63 | )) | ||
64 | .add('With long text', () => ( | ||
65 | <WithStoreInfobox | ||
66 | store={createStore({ | ||
67 | icon: 'mdiEarth', | ||
68 | ctaLabel: 'Ok, hi!', | ||
69 | })} | ||
70 | > | ||
71 | 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. | ||
72 | </WithStoreInfobox> | ||
73 | )) | ||
74 | .add('Secondary', () => ( | ||
75 | <WithStoreInfobox | ||
76 | store={createStore({ | ||
77 | icon: 'mdiEarth', | ||
78 | ctaLabel: 'Ok, hi!', | ||
79 | type: 'secondary', | ||
80 | })} | ||
81 | > | ||
82 | Welcome to the world of tomorrow | ||
83 | </WithStoreInfobox> | ||
84 | )) | ||
85 | .add('Success', () => ( | ||
86 | <WithStoreInfobox | ||
87 | store={createStore({ | ||
88 | icon: 'mdiEarth', | ||
89 | ctaLabel: 'Ok, hi!', | ||
90 | type: 'success', | ||
91 | })} | ||
92 | > | ||
93 | Welcome to the world of tomorrow | ||
94 | </WithStoreInfobox> | ||
95 | )) | ||
96 | .add('Warning', () => ( | ||
97 | <WithStoreInfobox | ||
98 | store={createStore({ | ||
99 | icon: 'mdiEarth', | ||
100 | ctaLabel: 'Ok, hi!', | ||
101 | type: 'warning', | ||
102 | })} | ||
103 | > | ||
104 | Welcome to the world of tomorrow | ||
105 | </WithStoreInfobox> | ||
106 | )) | ||
107 | .add('Danger', () => ( | ||
108 | <WithStoreInfobox | ||
109 | store={createStore({ | ||
110 | icon: 'mdiEarth', | ||
111 | ctaLabel: 'Ok, hi!', | ||
112 | type: 'danger', | ||
113 | })} | ||
114 | > | ||
115 | Welcome to the world of tomorrow | ||
116 | </WithStoreInfobox> | ||
117 | )) | ||
118 | .add('Inverted', () => ( | ||
119 | <WithStoreInfobox | ||
120 | store={createStore({ | ||
121 | icon: 'mdiEarth', | ||
122 | ctaLabel: 'Ok, hi!', | ||
123 | type: 'inverted', | ||
124 | })} | ||
125 | > | ||
126 | Welcome to the world of tomorrow | ||
127 | </WithStoreInfobox> | ||
128 | )) | ||
129 | .add('With className', () => ( | ||
130 | <WithStoreInfobox store={createStore({ | ||
131 | className: 'franz-is-awesome', | ||
132 | })}> | ||
133 | Welcome to the world of tomorrow | ||
134 | </WithStoreInfobox> | ||
135 | )); | ||