Skip to content

Commit

Permalink
fix: apply address checkbox custom color
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlLiu2023 committed Apr 12, 2023
1 parent 74966e0 commit 324b2be
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
21 changes: 21 additions & 0 deletions apps/storefront/src/pages/address/components/AddressForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
forwardRef,
useImperativeHandle,
Ref,
useContext,
} from 'react'

import {
Expand Down Expand Up @@ -54,6 +55,10 @@ import {
StateProps,
} from '../shared/getAddressFields'

import {
CustomStyleContext,
} from '@/shared/customStyleButtton'

interface AddressFormProps {
addressFields: CustomFieldItems[],
updateAddressList: (isFirst?: boolean) => void,
Expand Down Expand Up @@ -105,6 +110,14 @@ const AddressForm = ({
isDefaultBilling: false,
})

const {
state: {
portalStyle: {
primaryColor = '',
},
},
} = useContext(CustomStyleContext)

const isB2BUser = !isBCPermission

const {
Expand Down Expand Up @@ -556,6 +569,11 @@ const AddressForm = ({
/>
)}
label={label}
sx={{
'& .MuiCheckbox-root.Mui-checked': {
color: primaryColor,
},
}}
/>
{
child && (
Expand All @@ -574,6 +592,9 @@ const AddressForm = ({
label={child.label}
sx={{
display: shippingBilling[name] ? '' : 'none',
'& .MuiCheckbox-root.Mui-checked': {
color: primaryColor,
},
}}
/>
)
Expand Down
22 changes: 22 additions & 0 deletions apps/storefront/src/pages/address/components/SetDefaultDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
ChangeEvent,
Dispatch,
SetStateAction,
useContext,
useEffect,
useState,
} from 'react'
Expand Down Expand Up @@ -33,6 +34,10 @@ import {
AddressItemType,
} from '../../../types/address'

import {
CustomStyleContext,
} from '@/shared/customStyleButtton'

interface SetDefaultDialogProps {
isOpen: boolean
setIsOpen: Dispatch<SetStateAction<boolean>>
Expand All @@ -51,6 +56,13 @@ export const SetDefaultDialog = (props: SetDefaultDialogProps) => {
updateAddressList,
companyId,
} = props
const {
state: {
portalStyle: {
primaryColor = '',
},
},
} = useContext(CustomStyleContext)

const [isMobile] = useMobile()

Expand Down Expand Up @@ -133,6 +145,11 @@ export const SetDefaultDialog = (props: SetDefaultDialogProps) => {
/>
)}
label="Set as default shipping address "
sx={{
'& .MuiCheckbox-root.Mui-checked': {
color: primaryColor,
},
}}
/>
<FormControlLabel
control={(
Expand All @@ -142,6 +159,11 @@ export const SetDefaultDialog = (props: SetDefaultDialogProps) => {
/>
)}
label="Set as default billing address "
sx={{
'& .MuiCheckbox-root.Mui-checked': {
color: primaryColor,
},
}}
/>
</FormGroup>
</Box>
Expand Down
19 changes: 19 additions & 0 deletions apps/storefront/src/pages/quote/components/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
useState,
useEffect,
KeyboardEvent,
useContext,
} from 'react'

import {
Expand Down Expand Up @@ -37,6 +38,10 @@ import {
storeHash,
} from '@/utils'

import {
CustomStyleContext,
} from '@/shared/customStyleButtton'

interface MessageProps {
date?: number,
message?: string,
Expand Down Expand Up @@ -164,6 +169,14 @@ const Message = ({
email,
status,
}: MsgsProps) => {
const {
state: {
portalStyle: {
primaryColor = '',
},
},
} = useContext(CustomStyleContext)

const messagesEndRef = useRef<HTMLDivElement>(null)
const changeReadRef = useRef(0)

Expand Down Expand Up @@ -409,6 +422,12 @@ const Message = ({
'& .MuiFormLabel-root': {
color: 'rgba(0, 0, 0, 0.38)',
},
'& .MuiInputLabel-root.Mui-focused': {
color: primaryColor,
},
'& .MuiFilledInput-root:after': {
borderBottom: `2px solid ${primaryColor || '#1976d2'}`,
},
}}
value={message}
onChange={(event) => { setMessage(event.target.value) }}
Expand Down
3 changes: 3 additions & 0 deletions apps/storefront/src/pages/quote/components/QuoteNote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ export const QuoteNote = () => {
'& .MuiFormLabel-root': {
color: 'rgba(0, 0, 0, 0.38)',
},
'& .MuiInputLabel-root.Mui-focused': {
color: primaryColor,
},
'& .MuiFilledInput-root:after': {
borderBottom: `2px solid ${primaryColor || '#1976d2'}`,
},
Expand Down

0 comments on commit 324b2be

Please sign in to comment.