diff --git a/src/api/goods.ts b/src/api/goods.ts index 07a4efd..d79fa2c 100644 --- a/src/api/goods.ts +++ b/src/api/goods.ts @@ -49,21 +49,27 @@ export const getSheetList = async ( // 특수문자 인코딩 const query = qs.stringify({ - coordinateRequestDto: { - latitude: center.getLat().toFixed(6), - longitude: center.getLng().toFixed(6), - latitudeDelta: (arr[1] - arr[0]).toFixed(6), - longitudeDelta: (arr[3] - arr[2]).toFixed(6), - }, - }); + // coordinateRequestDto: { + // latitude: center.getLat().toFixed(6), + // longitude: center.getLng().toFixed(6), + // latitudeDelta: (arr[1] - arr[0]).toFixed(6), + // longitudeDelta: (arr[3] - arr[2]).toFixed(6), + // }, + // pageable: { + // page: 0, + // size: 10, + // sort: [], + // }, - const response = await jigumeAxios - .get(`/api/goods/marker/list?${query}`) - .then((res) => res.data); + latitude: center.getLat().toFixed(6), + longitude: center.getLng().toFixed(6), + latitudeDelta: (arr[1] - arr[0]).toFixed(6), + longitudeDelta: (arr[3] - arr[2]).toFixed(6), + }); - console.log(response); + const response = await jigumeAxios.get(`/api/goods/marker/list?${query}`); - return response; + return response.data; }; export const getGoodsPage = async ( diff --git a/src/pages/Map/components/BottomSheetComponent/components/CategoryTag.tsx b/src/pages/Map/components/BottomSheetComponent/components/CategoryTag.tsx index 09acdc3..6d9690a 100644 --- a/src/pages/Map/components/BottomSheetComponent/components/CategoryTag.tsx +++ b/src/pages/Map/components/BottomSheetComponent/components/CategoryTag.tsx @@ -13,9 +13,7 @@ export default function CategoryTag({ }) { return (
{ const prevData = [...filter]; @@ -27,11 +25,7 @@ export default function CategoryTag({ setFilter(prevData); }} > - 필터 + 필터 {item.name}
); diff --git a/src/pages/Map/components/BottomSheetComponent/components/ContentHeader.tsx b/src/pages/Map/components/BottomSheetComponent/components/ContentHeader.tsx index 64cec70..f89dd80 100644 --- a/src/pages/Map/components/BottomSheetComponent/components/ContentHeader.tsx +++ b/src/pages/Map/components/BottomSheetComponent/components/ContentHeader.tsx @@ -24,45 +24,11 @@ export default function ContentHeader({
공동 구매 폼 내역 보기
-
- {chekedItem.length === filter_.length || !chekedItem.length ? ( -
- 제품군 카테고리 필터를 켜보세요 -
- ) : ( - filter_.map( - (item, index) => - item.checked && ( - { - const prevData = [...filter_]; - - prevData[index] = { - ...prevData[index], - checked: !item.checked, - }; - - setFilter(prevData); - }} - initial={{ opacity: 0 }} - animate={{ opacity: 1 }} - exit={{ opacity: 0 }} - transition={{ duration: 0.3 }} - > - {item.name} - closeIcon - - ) - ) - )} +
+ {open + ? '제품군 카테고리를 선택하세요' + : '찾으시는 제품이 있나요?'}
-
setOpen((prev) => !prev)} @@ -74,6 +40,46 @@ export default function ContentHeader({ )}
+ +
+ {filter_.map( + (item, index) => + item.checked && ( + { + const prevData = [...filter_]; + + prevData[index] = { + ...prevData[index], + checked: !item.checked, + }; + + setFilter(prevData); + }} + initial={{ opacity: 0 }} + animate={{ opacity: 1 }} + exit={{ opacity: 0 }} + transition={{ duration: 0.3 }} + > + {item.name} +
+ {item.name} +
+ 닫기 +
+ ) + )} +
{open && ( diff --git a/src/pages/Map/components/BottomSheetComponent/components/ItemComponent.tsx b/src/pages/Map/components/BottomSheetComponent/components/ItemComponent.tsx index 3df0fd2..cbbb59a 100644 --- a/src/pages/Map/components/BottomSheetComponent/components/ItemComponent.tsx +++ b/src/pages/Map/components/BottomSheetComponent/components/ItemComponent.tsx @@ -27,7 +27,7 @@ export default function ItemComponent({ goods }: { goods?: GoodsListDTO }) { return (
@@ -42,7 +42,7 @@ export default function ItemComponent({ goods }: { goods?: GoodsListDTO }) { 좋아요 checked); // preViewer if (preViewer && goodsArr.length > 0) return (
@@ -30,7 +31,7 @@ export default function ItemList({ if (goodsArr.length === 0) return (
{[1, 2, 3].map((item) => ( @@ -40,14 +41,14 @@ export default function ItemList({ ); return ( -
- {goodsArr.map((item) => { - const trueArr = filter.filter(({ checked }) => checked); - - if (!trueArr.find(({ idx }) => idx === item.categoryId)) - return
; - return item && ; - })} +
+ {goodsArr + .filter((item) => + trueArr.some((item2) => item2.idx === item.categoryId) + ) + .map((item) => ( + + ))}
); }