-
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.
## 💡 이슈 resolve #158 ## 🤩 개요 v1.0.2 업데이트 ## 🧑💻 작업 사항 - shop 페이지에 추천 api 연결 및 UI 추가 ## 📖 참고 사항 공유할 내용, 레퍼런스, 추가로 발생할 것으로 예상되는 이슈, 스크린샷 등을 넣어 주세요.
- Loading branch information
Showing
19 changed files
with
327 additions
and
114 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 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
File renamed without changes.
52 changes: 52 additions & 0 deletions
52
src/components/Shop/Organisms/ProductItemList/ProductList.view.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,52 @@ | ||
import { memo } from 'react'; | ||
|
||
import ShopSkeleton from '@templates/Skeleton/shop'; | ||
import classnames from 'classnames'; | ||
import ProductItem from 'src/components/Shop/molecules/ProductItem'; | ||
|
||
import RecommendItem from './RecommendItem.view'; | ||
import $ from './style.module.scss'; | ||
|
||
type Props = { | ||
isFetching: boolean; | ||
intersectRef: React.RefObject<HTMLDivElement>; | ||
noProducts: React.ReactNode; | ||
isRecommend: boolean; | ||
itemList?: (res.ProductSummary | res.RecommendProduct)[]; | ||
}; | ||
|
||
const isRecommendProduct = ( | ||
item: res.ProductSummary | res.RecommendProduct, | ||
): item is res.RecommendProduct => { | ||
return 'product' in item; | ||
}; | ||
|
||
function ProductListView(viewProps: Props) { | ||
const { isFetching, itemList, intersectRef, noProducts, isRecommend } = | ||
viewProps; | ||
// TODO: 윈도우 사이즈에 따라 스켈레톤 아이템 개수 다르게 하기 | ||
|
||
return ( | ||
<> | ||
{itemList && ( | ||
<article | ||
className={classnames($['product-list'], { | ||
[$['recommend-list']]: isRecommend, | ||
})} | ||
> | ||
{itemList.map((item) => { | ||
if (isRecommendProduct(item)) { | ||
return <RecommendItem key={item.id} {...{ item }} />; | ||
} | ||
return <ProductItem key={item.id} {...item} />; | ||
})} | ||
</article> | ||
)} | ||
{noProducts} | ||
<div ref={intersectRef} /> | ||
{isFetching && <ShopSkeleton itemNum={12} {...{ isRecommend }} />} | ||
</> | ||
); | ||
} | ||
|
||
export default memo(ProductListView); |
34 changes: 0 additions & 34 deletions
34
src/components/Shop/Organisms/ProductItemList/ProductListView.tsx
This file was deleted.
Oops, something went wrong.
File renamed without changes.
24 changes: 24 additions & 0 deletions
24
src/components/Shop/Organisms/ProductItemList/RecommendItem.view.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,24 @@ | ||
import { memo } from 'react'; | ||
|
||
import ProductItem from 'src/components/Shop/molecules/ProductItem'; | ||
|
||
import $ from './style.module.scss'; | ||
|
||
type Props = { | ||
item: res.RecommendProduct; | ||
}; | ||
|
||
function RecommendItem(viewProps: Props) { | ||
const { item } = viewProps; | ||
const { product, associatedProduct } = item; | ||
// TODO: 윈도우 사이즈에 따라 스켈레톤 아이템 개수 다르게 하기 | ||
|
||
return ( | ||
<div className={$['recommend-item']}> | ||
<ProductItem {...product} /> | ||
<ProductItem {...associatedProduct} /> | ||
</div> | ||
); | ||
} | ||
|
||
export default memo(RecommendItem); |
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.