aboutsummaryrefslogtreecommitdiffstats
path: root/uidev/src/stories/infobox.stories.tsx
blob: b5f86e37d646516b24c51e11247a86726c77a239 (plain) (blame)
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
import { mdiEarth } from '@mdi/js';
import { observable } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';

import { Infobox } from '@meetfranz/ui';
import { storiesOf } from '../stores/stories';

interface IStoreArgs {
  icon?: string;
  ctaLabel?: string;
  type?: string;
  dismissable?: boolean;
  className?: string;
}

const createStore = (args?: IStoreArgs) =>
  observable({
    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}
        className={store.className}
      >
        {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!',
      })}
    >
      Ferdi is your messaging app / former Emperor of Austria and combines chat
      & messaging services into one application. Ferdi 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>
  ))
  .add('With className', () => (
    <WithStoreInfobox
      store={createStore({
        className: 'franz-is-awesome',
      })}
    >
      Welcome to the world of tomorrow
    </WithStoreInfobox>
  ));