MED-174: added cart to mobile menu
This commit is contained in:
@@ -26,13 +26,6 @@ export async function HomeMenuNavigation(props: {
|
|||||||
const balanceSummary = workspace?.id
|
const balanceSummary = workspace?.id
|
||||||
? await getAccountBalanceSummary(workspace.id)
|
? await getAccountBalanceSummary(workspace.id)
|
||||||
: null;
|
: null;
|
||||||
const totalValue = props.cart?.total
|
|
||||||
? formatCurrency({
|
|
||||||
currencyCode: props.cart.currency_code,
|
|
||||||
locale: language,
|
|
||||||
value: props.cart.total,
|
|
||||||
})
|
|
||||||
: 0;
|
|
||||||
|
|
||||||
const cartQuantityTotal =
|
const cartQuantityTotal =
|
||||||
props.cart?.items?.reduce((acc, item) => acc + item.quantity, 0) ?? 0;
|
props.cart?.items?.reduce((acc, item) => acc + item.quantity, 0) ?? 0;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import {
|
|||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
} from '@kit/ui/dropdown-menu';
|
} from '@kit/ui/dropdown-menu';
|
||||||
import { If } from '@kit/ui/if';
|
import { If } from '@kit/ui/if';
|
||||||
|
import { Button } from '@kit/ui/shadcn/button';
|
||||||
import { Trans } from '@kit/ui/trans';
|
import { Trans } from '@kit/ui/trans';
|
||||||
|
|
||||||
// home imports
|
// home imports
|
||||||
@@ -85,10 +86,28 @@ export function HomeMobileNavigation(props: {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
|
<div className="flex justify-between gap-4">
|
||||||
|
<Link href={pathsConfig.app.cart}>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
className="relative mr-0 h-10 cursor-pointer border-1 px-4 py-2"
|
||||||
|
>
|
||||||
|
<ShoppingCart className="stroke-[1.5px]" />
|
||||||
|
{hasCartItems && (
|
||||||
|
<>
|
||||||
|
(
|
||||||
|
<span className="text-success font-bold">
|
||||||
|
{cartQuantityTotal}
|
||||||
|
</span>
|
||||||
|
)
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Button>
|
||||||
|
</Link>
|
||||||
<DropdownMenuTrigger>
|
<DropdownMenuTrigger>
|
||||||
<Menu className={'h-9'} />
|
<Menu className="h-6 w-6" />
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
|
</div>
|
||||||
<DropdownMenuContent sideOffset={10} className={'w-screen rounded-none'}>
|
<DropdownMenuContent sideOffset={10} className={'w-screen rounded-none'}>
|
||||||
<If condition={props.cart && hasCartItems}>
|
<If condition={props.cart && hasCartItems}>
|
||||||
<DropdownMenuGroup>
|
<DropdownMenuGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user