11import { useForm } from 'react-hook-form' ;
22
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-
333const Billing = ( { onSubmit } ) => {
344 const inputClasses =
355 '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 }) => {
9464 required : 'Dette feltet er påkrevd' ,
9565 } ) }
9666 />
97-
9867 { errors . address1 && (
9968 < span className = "text-red-500" >
10069 FEIL: { errors . address1 . message }
@@ -143,7 +112,6 @@ const Billing = ({ onSubmit }) => {
143112 required : 'Dette feltet er påkrevd' ,
144113 } ) }
145114 />
146-
147115 { errors . city && (
148116 < span className = "text-red-500" >
149117 FEIL: { errors . city . message }
@@ -166,7 +134,6 @@ const Billing = ({ onSubmit }) => {
166134 } ,
167135 } ) }
168136 />
169-
170137 { errors . email && (
171138 < span className = "text-red-500" >
172139 FEIL: { errors . email . message }
@@ -191,14 +158,12 @@ const Billing = ({ onSubmit }) => {
191158 value : 8 ,
192159 message : 'Maksimalt 8 tall i telefonnummeret' ,
193160 } ,
194-
195161 pattern : {
196162 value : / ^ [ 0 - 9 ] + $ / i,
197163 message : 'Ikke gyldig telefonnummer' ,
198164 } ,
199165 } ) }
200166 />
201-
202167 { errors . phone && (
203168 < span className = "text-red-500" >
204169 FEIL: { errors . phone . message }
0 commit comments