summaryrefslogtreecommitdiff
path: root/src-migrate
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-08-02 14:14:53 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-08-02 14:14:53 +0700
commit455e7b8daddec77f95929a7cb0eb31e8fa934e6d (patch)
tree930c8ee740e41d7f51e5d02fc41183a47cd034f9 /src-migrate
parent1f5adcf66c175dde3ce3694eedb1acddb05613e5 (diff)
<iman> update unchek cart
Diffstat (limited to 'src-migrate')
-rw-r--r--src-migrate/pages/shop/cart/index.tsx17
1 files changed, 15 insertions, 2 deletions
diff --git a/src-migrate/pages/shop/cart/index.tsx b/src-migrate/pages/shop/cart/index.tsx
index d28e8c4b..2204857a 100644
--- a/src-migrate/pages/shop/cart/index.tsx
+++ b/src-migrate/pages/shop/cart/index.tsx
@@ -31,6 +31,20 @@ const CartPage = () => {
const { loadCart, cart, summary } = useCartStore();
const useDivvice = useDevice();
const { setRefreshCart } = useProductCartContext()
+ const [isTop, setIsTop] = useState(true);
+
+
+ useEffect(() => {
+ const handleScroll = () => {
+ console.log("lokasi",window.scrollY)
+ setIsTop(window.scrollY < 200);
+ };
+
+ window.addEventListener('scroll', handleScroll);
+ return () => {
+ window.removeEventListener('scroll', handleScroll);
+ };
+ }, []);
useEffect(() => {
if (typeof auth === 'object' && !cart) {
@@ -108,7 +122,7 @@ const CartPage = () => {
<>
<div className={style['title']}>Keranjang Belanja</div>
<div className='h-2' />
- <div className='flex items-center object-center justify-between mt-2 mb-2 w-3/4'>
+ <div className={`flex items-center object-center justify-between w-3/4 ${isTop ? 'border-b-[0px]' : 'border-b-[1px]'} sticky top-[180px] bg-white py-4 border-gray-300 z-50`}>
<div className='flex items-center object-center'>
{isLoad && (
<Spinner className='my-auto' size='sm' />
@@ -130,7 +144,6 @@ const CartPage = () => {
<Tooltip
label={clsxm({
'Tidak ada item yang dipilih': !hasSelected,
- 'Terdapat item yang tidak ada harga': hasSelectNoPrice,
})}
>
<Button