diff options
author | Stefan Malzner <stefan@adlk.io> | 2019-01-04 12:16:14 +0100 |
---|---|---|
committer | Stefan Malzner <stefan@adlk.io> | 2019-01-04 12:16:14 +0100 |
commit | 010917a05e70216e13902aa255ee247c3e1ffdfa (patch) | |
tree | cf5d4f04381f9dceeb570e8a3ad63f346ca3096d /stories | |
parent | Fix missing packages in build (diff) | |
download | ferdium-app-010917a05e70216e13902aa255ee247c3e1ffdfa.tar.gz ferdium-app-010917a05e70216e13902aa255ee247c3e1ffdfa.tar.zst ferdium-app-010917a05e70216e13902aa255ee247c3e1ffdfa.zip |
move storybook to root + typescript
TODO: fix modules
Diffstat (limited to 'stories')
-rw-r--r-- | stories/input.stories.tsx | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/stories/input.stories.tsx b/stories/input.stories.tsx new file mode 100644 index 000000000..59accc99a --- /dev/null +++ b/stories/input.stories.tsx | |||
@@ -0,0 +1,97 @@ | |||
1 | import React from 'react'; | ||
2 | |||
3 | import { storiesOf } from '@storybook/react'; | ||
4 | import { action } from '@storybook/addon-actions'; | ||
5 | |||
6 | import { Input } from '../packages/forms/src'; | ||
7 | |||
8 | console.log('stories'); | ||
9 | |||
10 | const defaultProps = { | ||
11 | label: 'Label', | ||
12 | id: 'test1', | ||
13 | name: 'test1', | ||
14 | onChange: action('changed'), | ||
15 | focus: true, | ||
16 | }; | ||
17 | |||
18 | const defaultPasswordProps = { | ||
19 | label: 'Password', | ||
20 | type: 'password', | ||
21 | id: 'test1', | ||
22 | name: 'test1', | ||
23 | onChange: action('changed'), | ||
24 | focus: true, | ||
25 | }; | ||
26 | |||
27 | storiesOf('Input', module) | ||
28 | .add('Basic', () => ( | ||
29 | <Input | ||
30 | {...defaultProps} | ||
31 | placeholder="Placeholder text" | ||
32 | /> | ||
33 | )) | ||
34 | .add('Without Label', () => ( | ||
35 | <Input | ||
36 | {...defaultProps} | ||
37 | showLabel={false} | ||
38 | /> | ||
39 | )) | ||
40 | .add('Disabled', () => ( | ||
41 | <Input {...defaultProps} disabled /> | ||
42 | )) | ||
43 | .add('With prefix', () => ( | ||
44 | <Input | ||
45 | {...defaultProps} | ||
46 | prefix="https://" | ||
47 | /> | ||
48 | )) | ||
49 | .add('With suffix', () => ( | ||
50 | <Input | ||
51 | {...defaultProps} | ||
52 | suffix=".meetfranz.com" | ||
53 | /> | ||
54 | )) | ||
55 | .add('With pre-/suffix', () => ( | ||
56 | <Input | ||
57 | {...defaultProps} | ||
58 | prefix="https://" | ||
59 | suffix=".meetfranz.com" | ||
60 | /> | ||
61 | )) | ||
62 | .add('With error', () => ( | ||
63 | <Input | ||
64 | {...defaultProps} | ||
65 | value="faulty input" | ||
66 | error="This is a generic error message." | ||
67 | /> | ||
68 | )); | ||
69 | |||
70 | storiesOf('Password', module) | ||
71 | // .addDecorator(withThemesProvider(themes)) | ||
72 | .add('Basic', () => ( | ||
73 | <Input | ||
74 | {...defaultPasswordProps} | ||
75 | /> | ||
76 | )) | ||
77 | .add('Show password toggle', () => ( | ||
78 | <Input | ||
79 | {...defaultPasswordProps} | ||
80 | showPasswordToggle | ||
81 | /> | ||
82 | )) | ||
83 | .add('Score password', () => ( | ||
84 | <Input | ||
85 | {...defaultPasswordProps} | ||
86 | showPasswordToggle | ||
87 | scorePassword | ||
88 | /> | ||
89 | )) | ||
90 | .add('Score password with error', () => ( | ||
91 | <Input | ||
92 | {...defaultPasswordProps} | ||
93 | error="Password is too short" | ||
94 | showPasswordToggle | ||
95 | scorePassword | ||
96 | /> | ||
97 | )); | ||