@@ -6,25 +6,26 @@ import { action } from '@storybook/addon-actions'
6
6
7
7
const StaticInput = ( props ) => < input { ...props } />
8
8
const Input = dynamicInput ( ) ( StaticInput )
9
+ const inputName = 'inputName'
9
10
10
11
storiesOf ( 'LabeledField' , module )
11
12
. add ( 'default' , ( ) => (
12
13
< LabeledField
13
14
{ ...{
14
15
input : {
15
- name : 'input name' ,
16
+ name : inputName ,
16
17
} ,
17
18
meta : { } ,
18
19
} }
19
20
>
20
- < Input />
21
+ < Input id = { inputName } />
21
22
</ LabeledField >
22
23
) )
23
24
. add ( 'with error' , ( ) => (
24
25
< LabeledField
25
26
{ ...{
26
27
input : {
27
- name : 'input name' ,
28
+ name : inputName ,
28
29
} ,
29
30
meta : {
30
31
touched : true ,
@@ -33,14 +34,14 @@ storiesOf('LabeledField', module)
33
34
} ,
34
35
} }
35
36
>
36
- < Input />
37
+ < Input id = { inputName } />
37
38
</ LabeledField >
38
39
) )
39
40
. add ( 'hide error' , ( ) => (
40
41
< LabeledField
41
42
{ ...{
42
43
input : {
43
- name : 'input name' ,
44
+ name : inputName ,
44
45
} ,
45
46
meta : {
46
47
touched : true ,
@@ -50,28 +51,28 @@ storiesOf('LabeledField', module)
50
51
hideErrorLabel : true ,
51
52
} }
52
53
>
53
- < Input />
54
+ < Input id = { inputName } />
54
55
</ LabeledField >
55
56
) )
56
57
. add ( 'with custom label' , ( ) => {
57
58
// eslint-disable-next-line
58
59
const CustomLabel = ( { onClickLabel } ) => (
59
- < label onClick = { onClickLabel } htmlFor = " inputName" >
60
+ < label onClick = { onClickLabel } htmlFor = { inputName } >
60
61
This is a < b > custom</ b > label
61
62
</ label >
62
63
)
63
64
return (
64
65
< LabeledField
65
66
{ ...{
66
67
input : {
67
- name : ' inputName' ,
68
+ name : inputName ,
68
69
} ,
69
70
meta : { } ,
70
71
labelComponent : CustomLabel ,
71
72
onClickLabel : action ( 'Custom Label Clicked' ) ,
72
73
} }
73
74
>
74
- < Input id = " inputName" />
75
+ < Input id = { inputName } />
75
76
</ LabeledField >
76
77
)
77
78
} )
@@ -86,7 +87,7 @@ storiesOf('LabeledField', module)
86
87
< LabeledField
87
88
{ ...{
88
89
input : {
89
- name : ' inputName' ,
90
+ name : inputName ,
90
91
} ,
91
92
meta : {
92
93
touched : true ,
@@ -96,7 +97,7 @@ storiesOf('LabeledField', module)
96
97
errorComponent : CustomError ,
97
98
} }
98
99
>
99
- < Input id = " inputName" aria-describedby = "inputError" />
100
+ < Input id = { inputName } aria-describedby = "inputError" />
100
101
</ LabeledField >
101
102
)
102
103
} )
0 commit comments