Skip to content

Conversation

@hhhyyo
Copy link
Contributor

@hhhyyo hhhyyo commented Mar 24, 2022

PR Type

What kind of change does this PR introduce?

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

Related Issues

#25
#27
#28
#29
#37

What does this PR do?

  • polished 설치
  • SearchForm 컴포넌트 마이그레이션
  • Menu 컴포넌트 마이그레이션
  • Header 컴포넌트 마이그레이션
  • 404일때 url 주소 변경
  • 로고아이콘 svgr로 변경
  • button, iconbutton prop 타입 수정

Other information

헤더에서 인증관련 부분은 일단 제외했습니다.
스토리북에서 next.js useRouter 사용할 수 있게되면 주석을 해제해야하는 코드가 있습니다.

@hhhyyo hhhyyo added 🌟 feature 새로운 기능을 만들어요! ✨ style UI를 스타일링 해요! (CSS 작업) 🛠 refactor 리팩토링을 진행해요! ⚙️ conf 환경 설정 세팅이에요 ✈️ migration 마이그레이션 작업을 진행해요! 🧱 component 컴포넌트 단위 작업을 진행해요! labels Mar 24, 2022
@hhhyyo hhhyyo added this to the Sprint2 milestone Mar 24, 2022
@hhhyyo hhhyyo self-assigned this Mar 24, 2022
const router = useRouter();

useEffect(() => {
router.push('/404', undefined, { shallow: true });
Copy link
Member

Choose a reason for hiding this comment

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

헐... 이런 간단한 방법이!! ㅋㅋ 효원님 천재네요!

Copy link
Member

Choose a reason for hiding this comment

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

근데 이렇게 하면 404 컴포넌트가 로드된 후 한 번 더 html이 로드되면서 리다이렉트 되는건가요?

Copy link
Member

Choose a reason for hiding this comment

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

리다이렉트 후 뒤로가기 눌렀을 때 잘못된 url로 되돌아가는 걸 막고 싶으면 router.replace로 작업하는것도 생각해봐야 할 것 같아요.
https://nextjs.org/docs/api-reference/next/router#routerreplace

Copy link
Contributor Author

Choose a reason for hiding this comment

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

shallow 옵션을 주면 다시 실행 하지 않고 현재 페이지의 경로를 업데이트한다고 합니다!
저는 router.push랑 replace랑 동일하게 작동한다고 해석했는데 replace가 좀 더 명확할거같네요!
https://nextjs.org/docs/api-reference/next/router#routerpush

document.removeEventListener('scroll', controlHeader);
document.removeEventListener('scroll', controlScrollToTop);
};
}, []);
Copy link
Contributor

Choose a reason for hiding this comment

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

커스텀 훅으로 만들어서 사용하면 깔끔할것 같습니다~

Copy link
Contributor Author

Choose a reason for hiding this comment

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

네 알겠습니다~

}, []);

return (
<EmptyPage>
Copy link
Contributor

Choose a reason for hiding this comment

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

404 페이지도 필요하다면 next/head를 통해 메타태그를 달아주면 좋을것 같아요

Copy link
Contributor Author

Choose a reason for hiding this comment

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

어떤 내용이 들어갈지 생각해봐야될 것 같습니다!

const router = useRouter();

useEffect(() => {
router.push('/404', undefined, { shallow: true });
Copy link
Contributor

Choose a reason for hiding this comment

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

shallow가 무엇인가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

shallow 옵션을 주면 다시 실행 하지 않고 현재 페이지의 경로를 업데이트한다고 합니다!
https://nextjs.org/docs/api-reference/next/router#routerpush

@hhhyyo hhhyyo merged commit ad2f849 into TeamCooks:develop Mar 25, 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