-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmmc: (MB) moved CartAccordian to client Checkout Cart DT: Fixed selection when removing item ui: minor changes to media minor change to primitives/Accordian
- Loading branch information
1 parent
c8bb4ba
commit 28278be
Showing
17 changed files
with
196 additions
and
118 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 was deleted.
Oops, something went wrong.
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
60 changes: 60 additions & 0 deletions
60
packages/commerce/components/cart/cart-panel/total-area.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,60 @@ | ||
'use client' | ||
import React, { Suspense } from 'react' | ||
import { observer } from 'mobx-react-lite' | ||
|
||
import { cn } from '@hanzo/ui/util' | ||
|
||
import { formatCurrencyValue } from '../../../util' | ||
import PromoCode from './promo-code' | ||
import { useCommerce } from '../../../context' | ||
|
||
const TotalArea: React.FC<{ | ||
showPromoCode?: boolean | ||
showShipping?: boolean | ||
clx?: string | ||
}> = observer(({ | ||
showPromoCode=false, | ||
showShipping=false, | ||
clx | ||
}) => { | ||
|
||
const cmmc = useCommerce() | ||
|
||
return ( | ||
<div className={clx}> | ||
{showPromoCode && ( | ||
<Suspense> | ||
<PromoCode/> | ||
</Suspense> | ||
)} | ||
{(showShipping || showPromoCode) && ( | ||
<div className={'flex flex-col gap-0.5 pb-1.5 text-sm ' + (!showPromoCode ? 'border-t pt-1.5' : '')} > | ||
<p className='flex justify-between'> | ||
<span className='text-muted-1'>Subtotal</span> | ||
<span className='font-semibold'>{cmmc.cartTotal === 0 ? '0' : formatCurrencyValue(cmmc.cartTotal)}</span> | ||
</p> | ||
{cmmc.promoAppliedCartTotal !== cmmc.cartTotal && ( | ||
<p className='flex justify-between'> | ||
<span className='text-muted-1'>Promo Discount</span> | ||
<span className='font-semibold'>-{formatCurrencyValue(cmmc.cartTotal - cmmc.promoAppliedCartTotal)}</span> | ||
</p> | ||
)} | ||
{showShipping && ( | ||
<p className='flex justify-between'> | ||
<span className='text-muted-1'>Shipping</span> | ||
<span className='font-semibold'>Free Global Shipping</span> | ||
</p> | ||
)} | ||
</div> | ||
)} | ||
<p className={cn('border-t py-2 flex justify-between')}> | ||
TOTAL | ||
<span className='font-semibold'> | ||
{formatCurrencyValue(showPromoCode ? cmmc.promoAppliedCartTotal : cmmc.cartTotal)} | ||
</span> | ||
</p> | ||
</div> | ||
) | ||
}) | ||
|
||
export default TotalArea |
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
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
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
Oops, something went wrong.