This repository has been archived by the owner on Aug 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Input.js
89 lines (74 loc) · 1.81 KB
/
Input.js
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
import React from 'react'
import { storiesOf } from '@storybook/react'
import { Button, Input } from '../src/index.js'
const stories = storiesOf('Input', module)
stories.add('default', () => (
<Input />
))
stories.add('autocomplete', () => (
<div style={{width: 300}}>
<form autocomplete='on' action='/'>
<Input
autoFocus
label='First name'
name='fname'
placeholder='Ron'
type='text'
/>
<br />
<Button submit size='sm'>Submit</Button>
</form>
</div>
))
stories.add('helpText', () => (
<Input helpText='This text appears below the input' />
))
stories.add('hintText', () => (
<Input hintText='This text appears above the input' />
))
stories.add('multiline', () => (
<Input
multiline
autoFocus
placeholder='This is a textarea!'
/>
))
stories.add('multiline + resizable', () => (
<Input
multiline={3}
resizable
autoFocus
placeholder='This is a resizable textarea!'
/>
))
stories.add('label', () => (
<Input label='Labelled' autoFocus />
))
stories.add('placeholder', () => (
<Input placeholder='Hello' autoFocus />
))
stories.add('prefix + suffix', () => (
<Input prefix='$' suffix='.00' autoFocus />
))
stories.add('seamless', () => (
<Input seamless autoFocus />
))
stories.add('disabled', () => (
<Input disabled autoFocus />
))
stories.add('readonly', () => (
<Input readOnly autoFocus value={`I can't turn left`} />
))
stories.add('states', () => (
<div>
<Input state='error' autoFocus /><br />
<Input state='success' helpText="You're Awesome!" hintText="You're awesome!" autoFocus /><br />
<Input state='warning' autoFocus />
</div>
))
stories.add('sizes', () => (
<div>
<Input autoFocus placeholder='Regular' /><br />
<Input size='sm' autoFocus placeholder='Small' />
</div>
))