-
Notifications
You must be signed in to change notification settings - Fork 1
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
[FEAT-8] 헤더 세부 기능 구현 #20
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🚀 Storybook 링크: https://6789e91d8356b60e6b422469-bglpqosnde.chromatic.com/ |
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.
고생하셨습니다...!!!
컴포넌트 폴더 구조와 관련해서는 어쩔 수 없는 느낌이 강하게 들기는 합니다,,, 다른 대안이라면 admissionQuickLinkTabs와 concat 컴포넌트를 바텀시트 폴더 내부에 저장하는 방법이 있긴 하겠네요. 헤더에서 이를 사용하긴 하지만 결국 바텀시트 내부에서 동작하는 컴포넌트니까요..! 저라면 해당 방향으로 진행했을 것 같긴합니다...! 참고해주시면 좋을 것 같아요..!
function AdmissionQuickLinkTabs({ initialAdmissionType }: { initialAdmissionType: AdmissionType | null }) { | ||
const [selectedAdmissionType, setSelectedAdmissionType] = useState(initialAdmissionType ?? 'SUSI'); |
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.
진짜 사소한거긴한데 저는 해당 경우에 아래 방법처럼 기본값을 주는 방법을 선호하거든요...! 혹시 해당 방법에 대해서는 어떻게 생각하시나요?
function AdmissionQuickLinkTabs({ initialAdmissionType }: { initialAdmissionType: AdmissionType | null }) { | |
const [selectedAdmissionType, setSelectedAdmissionType] = useState(initialAdmissionType ?? 'SUSI'); | |
function AdmissionQuickLinkTabs({ initialAdmissionType='SUSI' }: { initialAdmissionType: AdmissionType}) { | |
const [selectedAdmissionType, setSelectedAdmissionType] = useState(initialAdmissionType); |
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.
좋은 의견 감사합니다! 다만 제안해주신 개선 방안이 기존 코드를 완벽히 대체 하지 못할 거 같아요 ㅠㅠ..
이유는 다음과 같습니다!
initialAdmissionType
은 null
값을 허용해야만 하는 상황입니다(사용자가 선택하기 전 admissionType
전역상태에서 null
값으로 초기화),
이 상황에서 매개변수 기본값 (="SUSI")는 예상대로 작동하지 않습니다.
- 매개변수 기본 값은 undefined 일 때만 작동하고, null이 전달되면 null이 useState에 전달되기 때문입니다
만약 제안해주신 방법을 사용하기 위해서는 부모 컴포넌트에서 AdmissionQuickLinkTabs
컴포넌트에서 props를 전달할 때 null
값일 시 props를 전달하지 않는 방법으로 수정할 수 있을거 같지만 개인적으로 해당 방법보다 기존 방법이 괜찮을거 같은데 어떻게 생각하시나용??
아니면 혹시 제가 제안 주신 부분을 잘못 이해하고 있다면 다시 한번 설명해주시면 감사하겠습니다 😢
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.
그러네요...! 너무 단순히 보이는 부분만 생각해서 말씀드린 것 같습니다! 기존 방법이 괜찮을 것 같네요!
현재 components/bottom-sheet는 공통 바텀시트 레이아웃으로 여러 곳에서 재사용될 수 있는 컴포넌트입니다. 헤더 메뉴용 바텀시트는 헤더에 종속된 컴포넌트이므로, 해당 폴더 내부보다는 components/header/bottom-sheet 폴더를 새로 만들어 관리하면 추후 유지보수 시 관련 코드를 찾고 수정하기 더 쉬울 것 같습니다. 혹시 해당 방법은 어떻게 생각하시나용?? |
말씀하신 것 처럼 header/bottom-sheet 폴더를 구성하는게 제일 좋아보여요! |
🚀 Storybook 링크: https://6789e91d8356b60e6b422469-zpdudrlnev.chromatic.com/ |
064c0a2 반영했습니다! |
📝 PR 내용
헤더 컴포넌트의 세부 적인 기능들을 구현했습니다.
✅ 작업 내용
📸 스크린 샷 / 영상 (선택)
참고
🤔 고민 했던 부분 (선택)
🔗 연관 이슈