Skip to content

Commit 8f26317

Browse files
committed
make the background color for the "shipping details" and "additional info" form headers, dynamic
1 parent 2e2fd9a commit 8f26317

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

src/components/AdditionalInfo/AdditionalInfo.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
} from 'react-bootstrap'
66
import { addDays, apiV2CompatibleStrings, convertToBase64 } from '../../resources/utilityFunctions'
77

8-
const AdditionalInfo = ({ defaultRequiredDate, updateRequestForm }) => {
8+
const AdditionalInfo = ({ backgroundColor, defaultRequiredDate, updateRequestForm }) => {
99
const [showProposalDate, setShowProposalDate] = useState(true)
1010
const [files, setFiles] = useState([])
1111
const fileRef = useRef(null)
@@ -40,7 +40,7 @@ const AdditionalInfo = ({ defaultRequiredDate, updateRequestForm }) => {
4040

4141
return (
4242
<Card className='mb-4'>
43-
<Card.Header className='h3'>Additional Information</Card.Header>
43+
<Card.Header className={`h3 bg-${backgroundColor}`}>Additional Information</Card.Header>
4444
<Card.Body>
4545
{showProposalDate
4646
&& (
@@ -108,7 +108,12 @@ const AdditionalInfo = ({ defaultRequiredDate, updateRequestForm }) => {
108108
}
109109

110110
AdditionalInfo.propTypes = {
111+
backgroundColor: PropTypes.string,
111112
updateRequestForm: PropTypes.func.isRequired,
112113
}
113114

115+
AdditionalInfo.defaultProps = {
116+
backgroundColor: 'light',
117+
}
118+
114119
export default AdditionalInfo

src/components/AdditionalInfo/AdditionalInfo.stories.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ const Template = (args) => <AdditionalInfo {...args} />
1010

1111
export const Default = Template.bind({})
1212
Default.args = {
13+
backgroundColor: 'light',
1314
updateRequestForm: (requestForm) => console.log({ requestForm }),
1415
}

src/components/ShippingDetails/ShippingDetails.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ const AddressForm = ({ addressType, billingCountry, shippingCountry, setShowBill
118118
)
119119
}
120120

121-
const ShippingDetails = ({ billingCountry, shippingCountry, updateRequestForm }) => {
121+
const ShippingDetails = ({ backgroundColor, billingCountry, shippingCountry, updateRequestForm }) => {
122122
const [showBilling, setShowBilling] = useState(true)
123123

124124
return (
125125
<Card className='mb-4'>
126-
<Card.Header className='h3'>Shipping Details</Card.Header>
126+
<Card.Header className={`h3 bg-${backgroundColor}`}>Shipping Details</Card.Header>
127127
<AddressForm
128128
addressType='shipping'
129129
billingCountry={billingCountry}
@@ -154,11 +154,16 @@ AddressForm.propTypes = {
154154
}
155155

156156
ShippingDetails.propTypes = {
157+
backgroundColor: PropTypes.string,
157158
billingCountry: PropTypes.string.isRequired,
158159
shippingCountry: PropTypes.string.isRequired,
159160
updateRequestForm: PropTypes.func.isRequired,
160161
}
161162

163+
ShippingDetails.defaultProps = {
164+
backgroundColor: 'light',
165+
}
166+
162167
AddressForm.defaultProps = {
163168
showBilling: false,
164169
setShowBilling: () => {},

src/components/ShippingDetails/ShippingDetails.stories.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const Template = (args) => <ShippingDetails {...args} />
1010

1111
export const Default = Template.bind({})
1212
Default.args = {
13+
backgroundColor: 'light',
1314
billingCountry: 'USA',
1415
shippingCountry: 'USA',
1516
updateRequestForm: (requestForm) => console.log({ requestForm }),

0 commit comments

Comments
 (0)