-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FE] refactor: 카테고리 로직 수정 #637
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
굿굿 해온 코멘트 확인해주세요~~
const CategoryList = () => { | ||
const { data: foodCategories } = useCategoryQuery(CATEGORY_TYPE['FOOD']); | ||
const { data: storeCategories } = useCategoryQuery(CATEGORY_TYPE['STORE']); | ||
|
||
return ( | ||
<CategoryListContainer> | ||
<MenuListWrapper> | ||
{menuList.map((menu, index) => ( | ||
<Link key={`menuItem-${index}`} as={RouterLink} to={`products/food?category=${index + 1}`}> | ||
{foodCategories.map((menu) => ( | ||
<Link key={`menuItem-${menu.id}`} as={RouterLink} to={`products/food?category=${menu.id}`}> | ||
<CategoryItem name={menu.name} image={menu.image} /> | ||
</Link> | ||
))} | ||
</MenuListWrapper> | ||
<StoreListWrapper> | ||
{storeList.map((menu, index) => ( | ||
<Link key={`menuItem-${index}`} as={RouterLink} to={`products/store?category=${index + 6}`}> | ||
<CategoryItem key={`storeItem-${index}`} name={menu.name} image={menu.image} /> | ||
{storeCategories.map((menu) => ( | ||
<Link key={`menuItem-${menu.id}`} as={RouterLink} to={`products/store?category=${menu.id}`}> | ||
<CategoryItem name={menu.name} image={menu.image} /> | ||
</Link> | ||
))} | ||
</StoreListWrapper> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
근데 아까는 이게 최선일 것 같았는데 코드 보니까 밖에서 menuVariant
값을 받고 얘는 뿌려주는 역할만 하게끔 하면 어떨까 싶어요
const CategoryList = ({menuVariant}) => {
const { data: categories } = useCategoryQuery(CATEGORY_TYPE[menuVariant]);
return (
<ListWrapper>
{categories.map((menu) => (
<Link key={`menuItem-${menu.id}`} as={RouterLink} to={`products/${menuVariant}?category=${menu.id}`}>
<CategoryItem name={menu.name} image={menu.image} />
</Link>
))}
</ListWrapper>
)
이런식으로?? 그리고 밖에서는
<CategoryList menuVariant="FOOD"/>
<CategoryList menuVariant="STORE"/>
이렇게 쓰는걸로
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저도 동의!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생했어요 해온!
타미 의견만 확인해주세요~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
굿굿입니다~~~ 해옹
Issue
✨ 구현한 기능
카테고리 api에 이미지가 추가되어 그에 맞게 로직을 수정하였습니다.
📢 논의하고 싶은 내용
x
🎸 기타
x
⏰ 일정