-
Notifications
You must be signed in to change notification settings - Fork 0
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] 공통 컴포넌트 Appbar, Toast 편집 #93
Conversation
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthrough이번 PR은 Toast 컴포넌트와 Appbar 컴포넌트의 UI와 이벤트 핸들링을 수정합니다. Toast에서는 기존 error 아이콘을 새로운 warning 아이콘으로 교체하고, 새로운 success 아이콘을 추가했습니다. Appbar에서는 페이지 타입에 'mypage'와 'received'가 추가되었으며, 이에 따라 좌측 및 우측 아이콘 렌더링 로직과 이벤트 핸들러(onRightClickSecond)가 업데이트되어 레이아웃과 인터랙션이 개선되었습니다. Changes
Sequence Diagram(s)sequenceDiagram
participant U as 사용자
participant A as Appbar 컴포넌트
participant R1 as onRightClick
participant R2 as onRightClickSecond
U->>A: "받은" 페이지 우측 아이콘 클릭 (첫번째)
A->>R1: onRightClick 호출
U->>A: "받은" 페이지 우측 아이콘 클릭 (두번째)
A->>R2: onRightClickSecond 호출
Possibly related issues
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yml 📒 Files selected for processing (1)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
src/shared/ui/Toast/index.tsx (1)
48-50
: 🛠️ Refactor suggestion성공 토스트를 표시할 수 있는 기능이 없습니다.
현재 Toast 컴포넌트는 success 아이콘을 정의했지만, 실제로 성공 토스트를 표시하는 방법이 없습니다. 버튼 클릭 시 항상 error 토스트만 표시됩니다. toastType과 같은 프로퍼티를 추가하여 success 토스트도 표시할 수 있도록 개선해 보세요.
type toastProps = { buttonText: string; message: string; + toastType?: 'success' | 'error'; }; function Toast({ buttonText, message, toastType = 'error' }: toastProps) { return ( <> <Toaster icons={{ success: ( <Image src="/icons/toast-icon/checkIcon.svg" className="text-secondary" alt="success-icon" width={24} height={24} /> ), error: ( <Image src="/icons/toast-icon/warningIcon.svg" className="text-error-medium" alt="error-icon" width={24} height={24} /> ), }} position="bottom-right" /> <button className="text-white" - onClick={() => toast.error(message)} + onClick={() => toastType === 'success' ? toast.success(message) : toast.error(message)} > {buttonText} </button> </> ); }
🧹 Nitpick comments (5)
src/shared/ui/Toast/index.tsx (1)
27-35
: alt 속성 텍스트가 적절하지 않습니다.현재 success 아이콘에 사용된 alt 텍스트가 "error-icon"으로 되어 있습니다. 이는 접근성 측면에서 혼란을 줄 수 있습니다. 성공 아이콘에 맞는 alt 텍스트로 변경해주세요.
<Image src="/icons/toast-icon/checkIcon.svg" className="text-secondary" - alt="error-icon" + alt="success-icon" width={24} height={24} />src/shared/ui/appbar.tsx (4)
77-78
: JSDoc이 업데이트된 page 타입과 일치하지 않습니다.현재 JSDoc은 page 파라미터가 'main' | 'detail' | 'create'만 포함한다고 설명하고 있지만, 실제 타입은 'mypage'와 'received'도 포함하고 있습니다. 문서를 업데이트하여 일관성을 유지해주세요.
- * @param {string} page - 어떤 페이지인지 나타냅니다 ('main' | 'detail' | 'create') + * @param {string} page - 어떤 페이지인지 나타냅니다 ('main' | 'detail' | 'create' | 'mypage' | 'received')
81-83
: title 파라미터에 대한 JSDoc 설명이 누락되었습니다.새로 추가된 title 파라미터에 대한 JSDoc 설명이 누락되었습니다. 문서화를 통해 컴포넌트 사용 방법을 명확히 해주세요.
* @param {function} onRightClick - 오른쪽 버튼 클릭 시 실행할 함수 * @param {function} onRightClickSecond - (받은 명함) 두 번째 오른쪽 버튼 클릭 시 실행할 함수 + * @param {string} title - 헤더 중앙에 표시될 제목 텍스트 * * @returns {JSX.Element} - appbar 컴포넌트
32-32
: UI 일관성 개선이 필요합니다.'received' 케이스에서는 다른 케이스와 달리 버튼 대신 h1 요소를 반환합니다. 이는 레이아웃 일관성 및 사용자 경험에 영향을 줄 수 있습니다. 헤더 내 요소들의 UI 패턴을 일관되게 유지하는 것이 좋습니다.
'received' 케이스에서도 다른 케이스처럼 버튼을 사용하거나, 또는 전체 케이스에서 더 일관된 UI 패턴을 적용하는 것을 고려해보세요.
16-36
: 확장성을 고려한 코드 구조 개선이 필요합니다.현재 renderLeftIcon과 renderRightIcon 함수의 switch 케이스가 계속 늘어나고 있습니다. 이런 방식은 새로운 페이지 타입이 추가될 때마다 지속적인 수정이 필요하며, 유지보수가 어려워질 수 있습니다.
페이지 타입별 설정을 객체나 맵 형태로 관리하여 switch 문을 제거하는 방식을 고려해보세요. 이렇게 하면 새로운 페이지 타입을 추가할 때 함수 수정 없이 설정 객체만 확장하면 됩니다.
예시:
const pageConfigs = { main: { leftIcon: { component: <Image src="/icons/logo.svg" alt="로고" width={72} height={24} />, showAsButton: true }, rightIcon: { component: <Image src="/icons/alarmIcon.svg" alt="알람 아이콘" width={24} height={24} />, showAsButton: true } }, // 다른 페이지 타입들... }; function renderLeftIcon({ page, onLeftClick }: Pick<appbarPropsType, 'page' | 'onLeftClick'>) { const config = pageConfigs[page]?.leftIcon; if (!config) return null; return config.showAsButton ? ( <button onClick={onLeftClick}>{config.component}</button> ) : config.component; }
📜 Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
public/icons/searchIcon.svg
is excluded by!**/*.svg
public/icons/toast-icon/checkIcon.svg
is excluded by!**/*.svg
public/icons/toast-icon/warningIcon.svg
is excluded by!**/*.svg
📒 Files selected for processing (2)
src/shared/ui/Toast/index.tsx
(1 hunks)src/shared/ui/appbar.tsx
(4 hunks)
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.
제 기준에서 이 코드는 이븐하게 잘 작성된 것 같습니다. 고생하셨습니다. Approve
드리겠습니다. 🎊
* 🐛 Fix: 배포 env 백엔드 API 수정 (#91) * [Feat] 공통 컴포넌트 Appbar, Toast 편집 (#93) * ✨ Feat: Appbar 케이스 추가(받은 명함 페이지, 설정 페이지) * ✨ Feat: Toast 새 케이스 추가(success) * 🐛 Fix: onRightClickSecond potential issue 해결 * feat: 설정 list view를 구현합니다. (#95) * ♻️ Refactor: 사용하지 않는 타입 제거 * ♻️ Refactor: 리스트 item 설정 페이지 variant 확장 * ✨ Feat: 설정 리스트 view 구현 (#97) * [feat] 공통 컴포넌트 모달 구현 (#98) * ✨ Feat: 간격 lx 28px 확장 * 📦️ Chore: dialog 패키지 설치 * 💄 Style: radius 20px 추가 * 💄 Style: border, spacing 28px, 20px 추가 * ✨ Feat: 모달 컴포넌트 구현, 커스텀 모달 구현 * ✨ Feat: 공통 컴포넌트 버튼 - dialog 버튼 옵션 추가 * ✨ Feat: 세팅 다이얼로그 추가 * ✨ Feat: 공통 모달, 프로그래밍식 닫기 지원 example에 지원 설명 * [feat]: 회원 탈퇴 페이지 UI 구현, react hook form 구현 (#103) * feat: 회원 탈퇴 스키마 구현 * ✨ Feat: 공통 체크박스 버튼, 체크박스 버튼 그룹 구현 * ✨ Feat: 공통 fixedBottom 버튼 구현 * ✨ Feat: 회원탈퇴 react hook form 적용, ui 구현 완료 * ✨ Feat: 회원탈퇴 router 추가 * ♻️ Refactor: 카드세팅뷰 ; 추가 * ✨ Feat: 회원탈퇴 직접입력 필드 isDirty로 validation 필드가 동작을 하고 나서 validation 추가 * ♻️ Refactor: 가독성 개선, config 분리 * ✨ Feat: 알람 설정 UI 구현 (#105) * [feat] 받은 명함 상세 페이지 디자인 구현 (#100) * ♻️ refactor : next.config 이미지 경로 추가 * ✨feat : 수정 , 삭제 svg 추가 * ♻️ refactor : 로그인 후 경로 로직 수정 * ♻️ refactor : 카드 상세 페이지 높이 수정 * ✨feat : 명함 상세 응답 데이터 임시 변경 * ✨feat : 바텀 시트 상태 관리 훅 생성 * ✨feat : 받은 명함 데이터 임시 생성 * ✨feat : 받은 명함 타임 임시 작성 * ♻️ refactor : 내 명함 상세 타입 파일명 수정 * ✨feat : 받은 명함 타입 임시 작성 * ✨feat : 명상 상세 헤더 컴포넌트 한줄 메모 기능 추가 * ♻️ refactor : 명함 상세 페이지 불필요한 import 제거 * ♻️ refactor : 명함 상세 프로젝트 컴포넌트 링크 태그 추가 * ✨feat : 바텀 시트 공통 컴포넌트 생성 * ♻️ refactor : toast 위치 수정 * ♻️ refactor : 변수 주석 추가 * ♻️ refactor : 불필요한 타입 제거 및 예외 처리 추가 * ♻️ refactor : 토스트 중복 호출 제거 * ✨feat : appbar onLeftClick 기능 추가 * ♻️ refactor : memoInput으로 네이밍 수정 , z-index 수정 * ♻️ refactor : BottomMenuItem에 className 속성 추가 * [Feat] 명함 생성 - 메인화면 UI 구현 (#109) * 📦️ Chore: install tailwind-scrollbar-hide * ✨ Feat: 명함 생성 - 메인화면 UI 구현 (흥미로운 명함 카드 제외) * 💄 Style: Appbar title text color 추가, Thumbnail에 imageurl 추가 * ♻️ Refactor: 명함 상세뷰 분리 * ✨ Feat: useReceivedCardQuery 구현 및 Card previewInfoType의 type 수정 * 🐛 Fix: fix pnpm error * [Feat] Apple login 구현 (#110) * refactor: apple login key 수정 * refactor: apple login 구현 * [Feat] Onboarding 페이지 UI 수정 및 이미지 교체 (#99) * refactor: home swiper classname 지정 * refactor: onboarding image 첫 슬라이드 완성 * refactor: 슬라이드 및 디스크립션 구현 * refactor: second slide 구현 * feat: 세번째 슬라이드 생성 * refactor: 사용하지 않는 컴포넌트 제거 및 온보딩 페이지 라우팅 분리 대기 * refactor: 임시 슬라이드 index 수정 * refactor: 온보딩이랑 로그인 피쳐 분리 * style: 주석 추가 --------- Co-authored-by: 윤장원 <[email protected]> Co-authored-by: 영주 <[email protected]> Co-authored-by: JaeIn1 <[email protected]>
📌 개요
#90 [Feat] 공통 컴포넌트 Appbar, Toast 편집
📋 변경사항
화면
✅ 체크사항
Summary by CodeRabbit