-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ui@3.0.4, auth@2.0.4, cmmc@4.0.0; Cleaner buy flow (#63)
* working mobile select drawer and desktop select popup * adding item to cart closes drawer / popup (but not changing quantity) * version bumps
- Loading branch information
1 parent
81073b3
commit cdf5d0a
Showing
11 changed files
with
160 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
packages/commerce/components/buy-item/buy-item-mobile-drawer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
'use client' | ||
import React, { useState, type ReactNode } from 'react' | ||
|
||
import { X as LucideX} from 'lucide-react' | ||
import { Sheet, SheetContent, SheetTrigger } from '@hanzo/ui/primitives' | ||
|
||
import { cn } from '@hanzo/ui/util' | ||
|
||
import BuyItemCard from './buy-item-card' | ||
|
||
const BuyItemMobileDrawer: React.FC<{ | ||
skuPath: string | ||
trigger: ReactNode | ||
triggerClx?: string | ||
drawerClx?: string | ||
cardClx?: string | ||
}> = ({ | ||
skuPath, | ||
trigger, | ||
triggerClx='', | ||
drawerClx='', | ||
cardClx='' | ||
}) => { | ||
|
||
const [open, setOpen] = useState<boolean>(false) | ||
|
||
const onQuantityChanged = (sku: string, oldV: number, newV: number) => { | ||
if (oldV === 0 && newV === 1) { | ||
setTimeout(() => {setOpen(false)}, 150) | ||
} | ||
} | ||
|
||
return ( | ||
<Sheet open={open} onOpenChange={setOpen} > | ||
<SheetTrigger asChild className={triggerClx}> | ||
{trigger} | ||
</SheetTrigger> | ||
<SheetContent | ||
className={cn('rounded-tl-xl rounded-tr-xl p-0 overflow-hidden border-none', drawerClx)} | ||
side="bottom" | ||
> | ||
<BuyItemCard skuPath={skuPath} mobile onQuantityChanged={onQuantityChanged} className={cn("w-full relative ", cardClx)}/> | ||
</SheetContent> | ||
</Sheet> | ||
) | ||
} | ||
|
||
export default BuyItemMobileDrawer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.