Skip to content

Commit

Permalink
fix: page layout and change title size
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianJiang2021 committed Mar 17, 2023
1 parent 51cad65 commit 1ee4418
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 9 deletions.
2 changes: 1 addition & 1 deletion apps/storefront/src/components/layout/B3Mainheader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const B3Mainheader = ({
sx={{
height: '40px',
m: '0',
fontSize: '32px',
fontSize: '34px',
fontWeight: 400,
lineHeight: '42px',
display: 'flex',
Expand Down
12 changes: 9 additions & 3 deletions apps/storefront/src/hooks/useRegisteredbctob2b.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
useEffect,
SetStateAction,
Dispatch,
useCallback,
} from 'react'

import {
Expand All @@ -14,6 +14,10 @@ import type {

import globalB3 from '@b3/global-b3'

import {
useMutationObservable,
} from '@b3/hooks'

const useRegisteredbctob2b = (setOpenPage: Dispatch<SetStateAction<OpenPageState>>, isB2BUser: boolean, customerId:number | string) => {
const b3Lang = useB3Lang()

Expand All @@ -28,8 +32,8 @@ const useRegisteredbctob2b = (setOpenPage: Dispatch<SetStateAction<OpenPageState
return convertB2BNavNode
}

useEffect(() => {
if (!isB2BUser && customerId) {
const cd = useCallback(() => {
if (!isB2BUser && customerId && document.querySelector(globalB3['dom.navUserLoginElement'])) {
// already exist
if (document.querySelector('.navUser-item.navUser-convert-b2b')) {
return
Expand All @@ -52,6 +56,8 @@ const useRegisteredbctob2b = (setOpenPage: Dispatch<SetStateAction<OpenPageState
document.querySelector('.navUser-item.navUser-convert-b2b')?.remove()
}
}, [isB2BUser, customerId])

useMutationObservable(document.documentElement, cd)
}

export {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ interface OrderCheckboxProductProps {
getProductQuantity?: (item: EditableProductItem) => number
onProductChange?: (products: EditableProductItem[]) => void
setCheckedArr?: (items: number[]) => void
textAlign?: string,
}

interface FlexProps {
Expand All @@ -43,6 +44,7 @@ interface FlexItemProps {
padding?: string,
flexBasis?: string,
minHeight?: string,
textAlignLocation?: string,
}

const Flex = styled('div')(({
Expand Down Expand Up @@ -82,11 +84,13 @@ const FlexItem = styled('div')(({
width,
padding = '0',
flexBasis,
textAlignLocation,
}: FlexItemProps) => ({
display: 'flex',
flexGrow: width ? 0 : 1,
flexShrink: width ? 0 : 1,
alignItems: 'flex-start',
justifyContent: textAlignLocation === 'right' ? 'flex-end' : 'flex-start',
flexBasis,
width,
padding,
Expand Down Expand Up @@ -137,6 +141,7 @@ export const OrderCheckboxProduct = (props: OrderCheckboxProductProps) => {
getProductQuantity = (item) => item.editQuantity,
onProductChange = () => {},
setCheckedArr = () => {},
textAlign = 'right',
} = props

const [isMobile] = useMobile()
Expand Down Expand Up @@ -220,13 +225,22 @@ export const OrderCheckboxProduct = (props: OrderCheckboxProductProps) => {
<FlexItem flexBasis="100px">
<ProductHead>Product</ProductHead>
</FlexItem>
<FlexItem {...itemStyle.default}>
<FlexItem
textAlignLocation={textAlign}
{...itemStyle.default}
>
<ProductHead>Price</ProductHead>
</FlexItem>
<FlexItem {...itemStyle.qty}>
<FlexItem
textAlignLocation={textAlign}
{...itemStyle.qty}
>
<ProductHead>Qty</ProductHead>
</FlexItem>
<FlexItem {...itemStyle.default}>
<FlexItem
textAlignLocation={textAlign}
{...itemStyle.default}
>
<ProductHead>Cost</ProductHead>
</FlexItem>
</Flex>
Expand Down Expand Up @@ -289,13 +303,17 @@ export const OrderCheckboxProduct = (props: OrderCheckboxProductProps) => {
</Box>
</FlexItem>
<FlexItem
textAlignLocation={textAlign}
padding="10px 0 0"
{...itemStyle.default}
>
{isMobile && <span>Price: </span>}
{`${currencyInfo.currency_token} ${getProductPrice(product.base_price)}`}
</FlexItem>
<FlexItem {...itemStyle.qty}>
<FlexItem
textAlignLocation={textAlign}
{...itemStyle.qty}
>
<TextField
type="number"
variant="filled"
Expand All @@ -318,6 +336,7 @@ export const OrderCheckboxProduct = (props: OrderCheckboxProductProps) => {
/>
</FlexItem>
<FlexItem
textAlignLocation={textAlign}
padding="10px 0 0"
{...itemStyle.default}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ export const OrderShipping = () => {
currency={currency}
totalText="Cost"
canToProduct
textAlign="right"
/>
</Fragment>
) : <></>
Expand Down
2 changes: 1 addition & 1 deletion apps/storefront/src/pages/quote/QuoteDraft.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ const QuoteDraft = ({
<Typography
component="h3"
sx={{
fontSize: '32px',
fontSize: '34px',
mr: '1rem',
mb: `${isMobile ? '1rem' : '0'}`,
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ export const ProductListDialog = (props: ProductListDialogProps) => {
<ProductTable
products={productList}
quantityEditable
textAlign="right"
onProductQuantityChange={onProductQuantityChange}
renderAction={(product) => (
<ProductTableAction
Expand Down

0 comments on commit 1ee4418

Please sign in to comment.