Skip to content

Conversation

@hustle-dev
Copy link
Contributor

@hustle-dev hustle-dev commented Mar 25, 2022

PR Type

What kind of change does this PR introduce?

  • 버그를 수정했어요.
  • 새로운 기능을 추가했어요.
  • 코드 스타일 업데이트를 했어요(포맷팅, 지역변수)
  • 리팩토링을 했어요 (기능적인 변화 없이, api 변경 없이)
  • 환경설정을 변경했어요.
  • 문서 내용을 변경했어요.
  • 기타 사항을 설명해 주세요.

Related Issues

#15
#12
#9

What does this PR do?

  • 카드 컴포넌트 마이그레이션
  • HotRecipes 컴포넌트 마이그레이션
  • Skeleton 카드 리팩토링
  • 랜덤 레시피 컴포넌트 마이그레이션
  • Next.js 스토리북 설정(nextjs useRouter를 위한 설정)

Other information

고려해야하는 부분

Next를 사용하면서 Loading없이 Detail을 페이지로 들고,
Dialog 컴포넌트를 사용하지 않으므로 이에따른 로직 변경이 필요해짐

기존의 컴포넌트, 로직과 많이 달라진 부분이 있어 이에대한 논의와 설계가 다시 필요할것 같습니다.
@hustle-dev hustle-dev added 🌟 feature 새로운 기능을 만들어요! ✨ style UI를 스타일링 해요! (CSS 작업) 🛠 refactor 리팩토링을 진행해요! ⚙️ conf 환경 설정 세팅이에요 ✈️ migration 마이그레이션 작업을 진행해요! 🧱 component 컴포넌트 단위 작업을 진행해요! labels Mar 25, 2022
@hustle-dev hustle-dev added this to the Sprint2 milestone Mar 25, 2022
@hustle-dev hustle-dev self-assigned this Mar 25, 2022
@hustle-dev hustle-dev changed the title Card 컴포넌트 마이그레이션, Skeleton 카드 리팩토링, Next.js Storybook 설정 Card 컴포넌트 마이그레이션, Skeleton 카드 리팩토링, RandomRecipe 컴포넌트, Next.js Storybook 설정 Mar 27, 2022
@hustle-dev hustle-dev changed the title Card 컴포넌트 마이그레이션, Skeleton 카드 리팩토링, RandomRecipe 컴포넌트, Next.js Storybook 설정 Card, RandomRecipe, HotRecipe 컴포넌트 마이그레이션, Skeleton 카드 리팩토링, Next.js Storybook 설정 Mar 27, 2022

return (
<Link href={`${router.pathname}?id=${id}`}>
<CardLink role="button">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

기존과는 다르게 모달이 아니라 페이지를 전환하기 때문에 role="button" 어트리뷰트를 제거해도 될 것 같습니다!

const [isLoading, setIsLoading] = useState(false);

const router = useRouter();
// useAuthUser 훅 이후 주석해제
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 로직은 detail 페이지에서 사용하는 것이기 때문에 삭제해도 괜찮을 것 같습니당

const getRecipe = useCallback(() => {
setRecipe(savedRecipe);
const { data } = useGetRandomRecipeQuery(1);
if (data) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기서 받아오는 값이 RandomRecipe | undefined로 나와서 이렇게 해주었는데 더 효과적, 효율적으로 하는 방법은 없을지?

if (isLoading) {
return <SkeletonCard type="wide" background="white" hasSummary={true} headingPosition="bottomLeft" />;
} else {
const { id, title, summary, image } = recipe as RandomRecipeType;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

타입 단언말고 알아서 추론하게 해주는 방법이 없는지?

title,
summary = '',
}: CardProps): JSX.Element => {
const [recipeData, setRecipeData] = useState({});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

디테일 페이지에 필요한 로직이라서 지우시면 될 것 같습니다!


return (
<Link href={`${router.pathname}?id=${id}`}>
<CardLink role="button">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

원래는 모달창을 여는 버튼이라 role속성이 필요했는데
이제 진짜 페이지 이동이라서 없어도 될 것 같습니다

// };

return (
<Link href={`${router.pathname}?id=${id}`}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'/recipe/${id}' 형식으로 변경해주시면 됩니다!

@hustle-dev hustle-dev merged commit 00ba33a into TeamCooks:develop Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🧱 component 컴포넌트 단위 작업을 진행해요! ⚙️ conf 환경 설정 세팅이에요 🌟 feature 새로운 기능을 만들어요! ✈️ migration 마이그레이션 작업을 진행해요! 🛠 refactor 리팩토링을 진행해요! ✨ style UI를 스타일링 해요! (CSS 작업)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants