Skip to content

Commit

Permalink
[refactor]: 장바구니 아이템 페칭시 헤더는 정상적으로 보일 수 있도록 로직 수정(#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
devkyoung2 committed Jun 18, 2024
1 parent f7e567a commit 52fdfe6
Showing 1 changed file with 32 additions and 34 deletions.
66 changes: 32 additions & 34 deletions src/pages/Cart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,42 +68,40 @@ const Cart = () => {

return (
<>
<Header />
{isFetched && (
<>
<Header />
<section className={styles.area_cart}>
<MainWrapper>
<div className={styles.wrapper_cart}>
<div className={styles.wrapper_cart_box}>
<CartBoxHeader isItemInCart={isItemInCart} />
{isItemInCart ? (
<ul className={styles.wrapper_item}>
{cartItems!.map((item) => (
<li key={item.cartId}>
<CartBoxItem
item={item}
handleSelect={handleSelect}
isSelected={selectedItems.some(
(selectedItem) =>
selectedItem.productId === item.productId,
)}
/>
</li>
))}
</ul>
) : (
<EmptyCartBoxBody />
)}
<CartBoxFooter isItemInCart={isItemInCart} />
</div>
<CartPay
selectedItems={selectedItems}
totalPayment={totalPayment}
/>
<section className={styles.area_cart}>
<MainWrapper>
<div className={styles.wrapper_cart}>
<div className={styles.wrapper_cart_box}>
<CartBoxHeader isItemInCart={isItemInCart} />
{isItemInCart ? (
<ul className={styles.wrapper_item}>
{cartItems!.map((item) => (
<li key={item.cartId}>
<CartBoxItem
item={item}
handleSelect={handleSelect}
isSelected={selectedItems.some(
(selectedItem) =>
selectedItem.productId === item.productId,
)}
/>
</li>
))}
</ul>
) : (
<EmptyCartBoxBody />
)}
<CartBoxFooter isItemInCart={isItemInCart} />
</div>
</MainWrapper>
</section>
</>
<CartPay
selectedItems={selectedItems}
totalPayment={totalPayment}
/>
</div>
</MainWrapper>
</section>
)}
{isLoading && <Spinner />}
</>
Expand Down

0 comments on commit 52fdfe6

Please sign in to comment.