Skip to content

Commit

Permalink
fix: set logo and default value
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianJiang2021 committed Apr 28, 2023
1 parent ef8e8ce commit 27b2ee7
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2 deletions.
3 changes: 2 additions & 1 deletion apps/storefront/src/components/layout/B3Logo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useContext } from 'react'
// } from '@mui/material/styles'
import { Box, ImageListItem } from '@mui/material'

import { STORE_DEFAULT_LOGO } from '@/constants'
import { useMobile } from '@/hooks'
import { GlobaledContext } from '@/shared/global'

Expand Down Expand Up @@ -50,7 +51,7 @@ export default function B3Logo() {
window.location.href = '/'
}}
>
<img src={logo} alt="logo" />
<img src={logo || STORE_DEFAULT_LOGO} alt="logo" />
</ImageListItem>
</Box>
)
Expand Down
4 changes: 3 additions & 1 deletion apps/storefront/src/components/layout/B3Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ export default function B3Nav({ closeSidebar }: B3NavProps) {
open: true,
title: 'Registration',
message:
'Please create an account, or login to create a shopping list.',
item.configKey === 'shoppingLists'
? 'Please create an account, or login to create a shopping list.'
: 'To receive full access to buyer portal, please register. It will take 2 minutes.',
cancelText: 'Cancel',
saveText: 'Register',
saveFn: jumpRegister,
Expand Down
3 changes: 3 additions & 0 deletions apps/storefront/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ export const re = {

export const PRODUCT_DEFAULT_IMAGE =
'https://cdn11.bigcommerce.com/s-1i6zpxpe3g/stencil/cd9e3830-4c73-0139-8a51-0242ac11000a/e/4fe76590-73f1-0139-3767-32e4ea84ca1d/img/ProductDefault.gif'

export const STORE_DEFAULT_LOGO =
'https://cdn.bundleb2b.net/b2blogo/b2be-logo.png'
46 changes: 46 additions & 0 deletions apps/storefront/src/utils/storefrontConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,52 @@ const getTemPlateConfig = async (
if (storeforntKey.key === 'quote_logo') {
logo = item.value
}
if (storeforntKey.key === 'quote_on_product_page') {
item.extraFields = {
...item.extraFields,
locationSelector:
item.extraFields?.locationSelector || '.add-to-cart-buttons',
classSelector: item.extraFields?.classSelector || 'button',
customCss: item.extraFields?.customCss || 'margin-top: 0.5rem',
}
}

if (storeforntKey.key === 'quote_on_cart_page') {
item.extraFields = {
...item.extraFields,
classSelector: item.extraFields?.classSelector || 'button',
}
}
if (storeforntKey.key === 'masquerade_button') {
item.extraFields = {
...item.extraFields,
color: item.extraFields?.color || '#ED6C02',
location: item.extraFields?.location || ' bottomLeft',
horizontalPadding: item.extraFields?.horizontalPadding || '20',
verticalPadding: item.extraFields?.verticalPadding || '20',
}
}

if (storeforntKey.key === 'quote_floating_action_button') {
item.extraFields = {
...item.extraFields,
color: item.extraFields?.color || '#E00F36',
location: item.extraFields?.location || ' bottomRight',
horizontalPadding: item.extraFields?.horizontalPadding || '20',
verticalPadding: item.extraFields?.verticalPadding || '20',
}
}

if (storeforntKey.key === 'shopping_list_on_product_page') {
item.extraFields = {
...item.extraFields,
locationSelector:
item.extraFields?.locationSelector || '.add-to-cart-buttons',
classSelector: item.extraFields?.classSelector || 'button',
customCss: item.extraFields?.customCss || 'margin-top: 0.5rem',
}
}

;(obj as CustomFieldItems)[(storeforntKey as StoreforntKeysProps).name] =
{
...item.extraFields,
Expand Down

0 comments on commit 27b2ee7

Please sign in to comment.