From bf46a51d39a02f077904f9242bc69e692bdfb8ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?s=E1=B4=8F=CA=9F=CA=99=C9=AA=20=E2=98=94=EF=B8=8F?= Date: Thu, 18 Apr 2024 23:35:43 +0900 Subject: [PATCH 1/2] =?UTF-8?q?refactor:=20=EA=B8=B0=EC=B4=88=20recipe=20i?= =?UTF-8?q?tem=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EA=B5=AC=ED=98=84?= =?UTF-8?q?=20(#83)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor: 기초 recipe item 컴포넌트 구현 * fix: 자동 배포 오류 수정 * refactor: 작가와 생성된 날짜 묶기 * refactor: recipe 가져오는 방식 변경 * refactor: css 없어진 속성 삭제 * refactor: 각 컴포넌트 추가 * refactor: 스토리북 내부 컴포넌트로 교체 * refactor: 기본 이미지 랜덤 이미지로 변경 * refactor: 레시피 랭킹 컴포넌트 교체 * refactor: recipe item 컴포넌트 export 방식 변경 * refactor: 상품 상세 포함된 꿀조합 컴포넌트 수정 * refactor: 꿀조합 페이지 컴포넌트 변경 * chore: lint 적용 * refactor: image 감싸는 div에 line height 0 부여 * refactor: 컴포넌트에서 바로 recipe 받도록 수정 --- .../MemberRecipeList/MemberRecipeList.tsx | 3 +- .../ProductRecipeList/ProductRecipeList.tsx | 4 +- .../RecipeRankingItem.stories.tsx | 18 -- .../RecipeRankingItem/RecipeRankingItem.tsx | 33 --- .../recipeRankingItem.css.ts | 31 --- .../RecipeRankingList/RecipeRankingList.tsx | 4 +- src/components/Rank/index.ts | 1 - .../recipeFavoriteButton.css.ts | 1 - .../Recipe/RecipeItem/RecipeItem.stories.tsx | 34 ++- .../Recipe/RecipeItem/RecipeItem.tsx | 261 ++++++++++++++---- .../Recipe/RecipeItem/recipeItem.css.ts | 52 +++- .../Recipe/RecipeList/RecipeList.tsx | 4 +- src/components/Recipe/index.ts | 5 + src/constants/image.ts | 7 +- src/contexts/RecipeItemContext.tsx | 21 ++ src/hooks/context/index.ts | 1 + .../context/useRecipeItemValueContext.ts | 14 + src/mocks/data/recipeRankingList.json | 20 +- src/mocks/data/recipes.json | 21 ++ src/types/ranking.ts | 9 - src/types/recipe.ts | 4 +- src/types/response.ts | 4 +- 22 files changed, 372 insertions(+), 180 deletions(-) delete mode 100644 src/components/Rank/RecipeRankingItem/RecipeRankingItem.stories.tsx delete mode 100644 src/components/Rank/RecipeRankingItem/RecipeRankingItem.tsx delete mode 100644 src/components/Rank/RecipeRankingItem/recipeRankingItem.css.ts create mode 100644 src/contexts/RecipeItemContext.tsx create mode 100644 src/hooks/context/useRecipeItemValueContext.ts diff --git a/src/components/Members/MemberRecipeList/MemberRecipeList.tsx b/src/components/Members/MemberRecipeList/MemberRecipeList.tsx index 740daddff..445dd9e33 100644 --- a/src/components/Members/MemberRecipeList/MemberRecipeList.tsx +++ b/src/components/Members/MemberRecipeList/MemberRecipeList.tsx @@ -3,7 +3,6 @@ import { useRef } from 'react'; import { Link as RouterLink } from 'react-router-dom'; import styled from 'styled-components'; -import { RecipeItem } from '@/components/Recipe'; import { PATH } from '@/constants/path'; import { useIntersectionObserver } from '@/hooks/common'; import { useInfiniteMemberRecipeQuery } from '@/hooks/queries/members'; @@ -50,7 +49,7 @@ const MemberRecipeList = ({ isPreview = false }: MemberRecipeListProps) => { {recipeToDisplay?.map((recipe) => (
  • - + {/* */}
  • ))} diff --git a/src/components/Product/ProductRecipeList/ProductRecipeList.tsx b/src/components/Product/ProductRecipeList/ProductRecipeList.tsx index 6a943c664..8c5f0f241 100644 --- a/src/components/Product/ProductRecipeList/ProductRecipeList.tsx +++ b/src/components/Product/ProductRecipeList/ProductRecipeList.tsx @@ -3,7 +3,7 @@ import { Link } from 'react-router-dom'; import { container, moreIcon, moreIconWrapper, moreItem, moreLink } from './productRecipeList.css'; import { SvgIcon, Text } from '@/components/Common'; -import { RecipeItem } from '@/components/Recipe'; +import { DefaultRecipeItem } from '@/components/Recipe'; import { useInfiniteProductRecipesQuery } from '@/hooks/queries/product'; import { vars } from '@/styles/theme.css'; import displaySlice from '@/utils/displaySlice'; @@ -27,7 +27,7 @@ const ProductRecipeList = ({ productId }: ProductRecipeListProps) => {