8
8
import { CountryDropdown } from 'react-country-region-selector'
9
9
import PropTypes from 'prop-types'
10
10
11
- const AddressForm = ( { addressType, billingCountry, shippingCountry, setShowBilling,
11
+ const AddressForm = ( { addressType, billingCountry, disabled , shippingCountry, setShowBilling,
12
12
showBilling, updateRequestForm } ) => {
13
13
const handleChange = ( value ) => {
14
14
updateRequestForm ( value , 'billingSameAsShipping' )
@@ -31,6 +31,7 @@ const AddressForm = ({ addressType, billingCountry, shippingCountry, setShowBill
31
31
name = 'address1'
32
32
type = 'text'
33
33
className = 'prevent-validation-styles'
34
+ disabled = { disabled }
34
35
required
35
36
/>
36
37
< Form . Control . Feedback type = 'invalid' >
@@ -43,6 +44,7 @@ const AddressForm = ({ addressType, billingCountry, shippingCountry, setShowBill
43
44
placeholder = 'Address Line 2 (optional)'
44
45
onChange = { ( e ) => updateRequestForm ( e . target . value , `${ addressType } .street2` ) }
45
46
className = 'prevent-validation-styles'
47
+ disabled = { disabled }
46
48
/>
47
49
</ Form . Group >
48
50
@@ -53,6 +55,7 @@ const AddressForm = ({ addressType, billingCountry, shippingCountry, setShowBill
53
55
type = 'text'
54
56
required
55
57
className = 'prevent-validation-styles'
58
+ disabled = { disabled }
56
59
/>
57
60
< Form . Control . Feedback type = 'invalid' >
58
61
Please enter your city or region.
@@ -67,6 +70,7 @@ const AddressForm = ({ addressType, billingCountry, shippingCountry, setShowBill
67
70
type = 'text'
68
71
required
69
72
className = 'prevent-validation-styles'
73
+ disabled = { disabled }
70
74
/>
71
75
< Form . Control . Feedback type = 'invalid' >
72
76
Please enter your state or province.
@@ -80,6 +84,7 @@ const AddressForm = ({ addressType, billingCountry, shippingCountry, setShowBill
80
84
type = 'text'
81
85
required
82
86
className = 'prevent-validation-styles'
87
+ disabled = { disabled }
83
88
/>
84
89
< Form . Control . Feedback type = 'invalid' >
85
90
Please enter your zip or postal code.
@@ -94,6 +99,7 @@ const AddressForm = ({ addressType, billingCountry, shippingCountry, setShowBill
94
99
onChange = { ( e ) => updateRequestForm ( e , `${ addressType } .country` ) }
95
100
className = 'form-select mb-3 form-control prevent-validation-styles'
96
101
id = { `country-${ addressType } ` }
102
+ disabled = { disabled }
97
103
required
98
104
/>
99
105
< Form . Control . Feedback type = 'invalid' >
@@ -106,6 +112,7 @@ const AddressForm = ({ addressType, billingCountry, shippingCountry, setShowBill
106
112
className = 'prevent-validation-styles'
107
113
type = 'checkbox'
108
114
label = 'My shipping address is the same as my billing address.'
115
+ disabled = { disabled }
109
116
onChange = { ( ) => {
110
117
setShowBilling ( ! showBilling )
111
118
if ( showBilling ) handleChange ( true )
@@ -118,7 +125,7 @@ const AddressForm = ({ addressType, billingCountry, shippingCountry, setShowBill
118
125
)
119
126
}
120
127
121
- const ShippingDetails = ( { backgroundColor, billingCountry, shippingCountry, updateRequestForm } ) => {
128
+ const ShippingDetails = ( { backgroundColor, billingCountry, disabled , shippingCountry, updateRequestForm } ) => {
122
129
const [ showBilling , setShowBilling ] = useState ( true )
123
130
124
131
return (
@@ -131,13 +138,15 @@ const ShippingDetails = ({ backgroundColor, billingCountry, shippingCountry, upd
131
138
showBilling = { showBilling }
132
139
setShowBilling = { setShowBilling }
133
140
updateRequestForm = { updateRequestForm }
141
+ disabled = { disabled }
134
142
/>
135
143
{ showBilling && (
136
144
< AddressForm
137
145
addressType = 'billing'
138
146
billingCountry = { billingCountry }
139
147
shippingCountry = { shippingCountry }
140
148
updateRequestForm = { updateRequestForm }
149
+ disabled = { disabled }
141
150
/>
142
151
) }
143
152
</ Card >
@@ -147,6 +156,7 @@ const ShippingDetails = ({ backgroundColor, billingCountry, shippingCountry, upd
147
156
AddressForm . propTypes = {
148
157
addressType : PropTypes . string . isRequired ,
149
158
billingCountry : PropTypes . string . isRequired ,
159
+ disabled : PropTypes . bool . isRequired ,
150
160
showBilling : PropTypes . bool ,
151
161
setShowBilling : PropTypes . func ,
152
162
shippingCountry : PropTypes . string . isRequired ,
@@ -156,6 +166,7 @@ AddressForm.propTypes = {
156
166
ShippingDetails . propTypes = {
157
167
backgroundColor : PropTypes . string ,
158
168
billingCountry : PropTypes . string . isRequired ,
169
+ disabled : PropTypes . bool . isRequired ,
159
170
shippingCountry : PropTypes . string . isRequired ,
160
171
updateRequestForm : PropTypes . func . isRequired ,
161
172
}
0 commit comments