1
1
import { useForm } from 'react-hook-form' ;
2
2
3
- const Input = ( {
4
- name,
5
- label,
6
- //register,
7
- registerRef,
8
- placeholder,
9
- value,
10
- parameters,
11
- type = 'text' ,
12
- readOnly = false ,
13
- } ) => {
14
- const { register } = useForm ( ) ;
15
-
16
- return (
17
- < >
18
- < label className = "pb-4" > { label } </ label >
19
- < input
20
- className = "w-full px-4 py-2 mt-2 text-base bg-white border border-gray-400 rounded focus:outline-none focus:border-black"
21
- name = { name }
22
- placeholder = { placeholder }
23
- type = "text"
24
- value = { value }
25
- { ...register ( registerRef , parameters ) }
26
- type = { type }
27
- readOnly = { readOnly }
28
- />
29
- </ >
30
- ) ;
31
- } ;
32
-
33
3
const Billing = ( { onSubmit } ) => {
34
4
const inputClasses =
35
5
'w-full px-4 py-2 mt-2 text-base bg-white border border-gray-400 rounded focus:outline-none focus:border-black' ;
@@ -94,7 +64,6 @@ const Billing = ({ onSubmit }) => {
94
64
required : 'Dette feltet er påkrevd' ,
95
65
} ) }
96
66
/>
97
-
98
67
{ errors . address1 && (
99
68
< span className = "text-red-500" >
100
69
FEIL: { errors . address1 . message }
@@ -143,7 +112,6 @@ const Billing = ({ onSubmit }) => {
143
112
required : 'Dette feltet er påkrevd' ,
144
113
} ) }
145
114
/>
146
-
147
115
{ errors . city && (
148
116
< span className = "text-red-500" >
149
117
FEIL: { errors . city . message }
@@ -166,7 +134,6 @@ const Billing = ({ onSubmit }) => {
166
134
} ,
167
135
} ) }
168
136
/>
169
-
170
137
{ errors . email && (
171
138
< span className = "text-red-500" >
172
139
FEIL: { errors . email . message }
@@ -191,14 +158,12 @@ const Billing = ({ onSubmit }) => {
191
158
value : 8 ,
192
159
message : 'Maksimalt 8 tall i telefonnummeret' ,
193
160
} ,
194
-
195
161
pattern : {
196
162
value : / ^ [ 0 - 9 ] + $ / i,
197
163
message : 'Ikke gyldig telefonnummer' ,
198
164
} ,
199
165
} ) }
200
166
/>
201
-
202
167
{ errors . phone && (
203
168
< span className = "text-red-500" >
204
169
FEIL: { errors . phone . message }
0 commit comments