aboutsummaryrefslogtreecommitdiffstats
path: root/stories
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2019-01-04 12:16:14 +0100
committerLibravatar Stefan Malzner <stefan@adlk.io>2019-01-04 12:16:14 +0100
commit010917a05e70216e13902aa255ee247c3e1ffdfa (patch)
treecf5d4f04381f9dceeb570e8a3ad63f346ca3096d /stories
parentFix missing packages in build (diff)
downloadferdium-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.tsx97
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 @@
1import React from 'react';
2
3import { storiesOf } from '@storybook/react';
4import { action } from '@storybook/addon-actions';
5
6import { Input } from '../packages/forms/src';
7
8console.log('stories');
9
10const defaultProps = {
11 label: 'Label',
12 id: 'test1',
13 name: 'test1',
14 onChange: action('changed'),
15 focus: true,
16};
17
18const defaultPasswordProps = {
19 label: 'Password',
20 type: 'password',
21 id: 'test1',
22 name: 'test1',
23 onChange: action('changed'),
24 focus: true,
25};
26
27storiesOf('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
70storiesOf('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 ));