diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2024-08-02 07:22:43 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2024-08-02 07:22:43 +0000 |
| commit | 263513f288a164d4e14cb3ea407877f3fec3013b (patch) | |
| tree | 4d02787ee3156adb639f121c95a466a58b53522a /src-migrate/pages | |
| parent | 3224737f4d714dcf30887b4977263424e4773ec6 (diff) | |
| parent | 112b5a9fa738594749796fb65ede0c8ec900a84f (diff) | |
Merged in Feature/iman-unchek-cart (pull request #206)
<iman> error code
Diffstat (limited to 'src-migrate/pages')
| -rw-r--r-- | src-migrate/pages/shop/cart/index.tsx | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src-migrate/pages/shop/cart/index.tsx b/src-migrate/pages/shop/cart/index.tsx index e5e2c5cb..3bc857a6 100644 --- a/src-migrate/pages/shop/cart/index.tsx +++ b/src-migrate/pages/shop/cart/index.tsx @@ -31,7 +31,20 @@ const CartPage = () => { const { loadCart, cart, summary } = useCartStore(); const useDivvice = useDevice(); const { setRefreshCart } = useProductCartContext() + const [isTop, setIsTop] = useState(true); + + console.log("lokasi",window.scrollY) + useEffect(() => { + const handleScroll = () => { + setIsTop(window.scrollY < 200); + }; + + window.addEventListener('scroll', handleScroll); + return () => { + window.removeEventListener('scroll', handleScroll); + }; + }, []); useEffect(() => { if (typeof auth === 'object' && !cart) { @@ -109,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 w-3/4 ${window.scrollY < 200 ? '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 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' /> |
