♻️ enhan: close cart drawer when checkout

:%s
This commit is contained in:
lytrankieio123 2021-09-15 14:44:55 +07:00
parent 4371fa9d9f
commit 76635845ea
2 changed files with 8 additions and 3 deletions

View File

@ -25,7 +25,7 @@ const CartDrawer = ({ visible, onClose }: Props) => {
</div>
<div>
<CartMessage />
<CartCheckoutButton />
<CartCheckoutButton onClose={onClose}/>
</div>
</div>
</DrawerCommon>

View File

@ -4,11 +4,16 @@ import s from './CartCheckoutButton.module.scss';
import Link from 'next/link'
import { ROUTE } from 'src/utils/constanst.utils';
const CartCheckoutButton = memo(() => {
interface Props {
onClose: () => void
}
const CartCheckoutButton = memo(({ onClose }: Props) => {
return (
<Link href={ROUTE.CHECKOUT}>
<a className={s.cartCheckoutButton}>
<ButtonCommon size='large'>Check out - Rp 120.500</ButtonCommon>
<ButtonCommon size='large' onClick={onClose}>Check out - Rp 120.500</ButtonCommon>
</a>
</Link>
)