@@ -2,23 +2,21 @@ import { useForm } from 'react-hook-form';
22import { InputField } from '../Input/InputField.component' ;
33import { getCustomNumberValidation } from '../../functions/functions' ;
44
5- const customPostNumberValidation = getCustomNumberValidation (
6- {
7- minLength : 'Postnummer må være minimum 4 tall' ,
8- maxLength : 'Postnummer må være maksimalt 4 tall' ,
9- pattern : 'Postnummer må bare være tall' ,
10- } ,
11- 4
12- ) ;
13-
145const inputs = [
156 { label : 'Fornavn' , name : 'firstName' } ,
167 { label : 'Etternavn' , name : 'lastName' } ,
178 { label : 'Adresse' , name : 'address1' } ,
189 {
1910 label : 'Postnummer' ,
2011 name : 'postcode' ,
21- customValidation : customPostNumberValidation ,
12+ customValidation : getCustomNumberValidation (
13+ {
14+ minLength : 'Postnummer må være minimum 4 tall' ,
15+ maxLength : 'Postnummer må være maksimalt 4 tall' ,
16+ pattern : 'Postnummer må bare være tall' ,
17+ } ,
18+ 4
19+ ) ,
2220 } ,
2321 { label : 'Sted' , name : 'city' } ,
2422 {
@@ -42,11 +40,6 @@ const inputs = [
4240 8
4341 ) ,
4442 } ,
45- {
46- label : 'Postnummer' ,
47- name : 'postcode' ,
48- customValidation : customPostNumberValidation ,
49- } ,
5043] ;
5144
5245const Billing = ( { onSubmit } ) => {
0 commit comments