[Feat] 루트 레이아웃 구조 설정#20
Conversation
사이드바와 콘텐츠 영역을 조합하고, 로그인 라우트만 제외 적용할 수 있도록 Outlet 기반 layout route로 구성
activeKey/onNavigate 콜백 대신 NavLink로 전환해 RootLayout이 Outlet 기반으로 바뀌어도 별도 상태 전달 없이 현재 경로에서 활성 메뉴를 판단하도록 함. 메뉴별 경로는 실제 라우팅 등록 전 잠정값이며 라우팅 설계 확정 시 갱신 필요
콘텐츠 padding을 main에 직접 주면 Outlet 안에서 페이지가 그리는 PageHeader에도 적용돼 헤더 border-bottom이 안쪽으로 밀리는 문제가 있었음. padding은 페이지가 직접 콘텐츠 영역에 주도록 하고, PageHeader는 항상 흰 배경을 갖도록 기본값으로 되돌림
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughSidebar를 수동 상태 기반 버튼에서 React Router의 Changes사이드바 라우팅 및 레이아웃
페이지 헤더 배경 스타일
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Biome (2.5.3)src/index.cssFile contains syntax errors that prevent linting: Line 13: Tailwind-specific syntax is disabled.; Line 20: Tailwind-specific syntax is disabled.; Line 23: Tailwind-specific syntax is disabled. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
CI 결과
|
| return ( | ||
| <div className="bg-fill-netural min-h-screen"> | ||
| <Sidebar className="fixed inset-y-0 left-0" /> | ||
| <main className="flex min-h-screen flex-col pl-[220px]"> |
There was a problem hiding this comment.
220이 사이드바에서도 재사용 되는거 같은데 상수나 토큰으로 한 곳에서 처리하면 좋을 것 같습니다!!
Sidebar의 너비와 RootLayout의 콘텐츠 좌측 여백에 220px가 각자 하드코딩돼 있어 하나만 바뀌면 어긋날 수 있었음. index.css에 --spacing-sidebar 토큰을 추가해 w-sidebar/pl-sidebar로 공유
CI 결과
|
#️⃣ 연관된 이슈
🚧 Work in Progress
📌 주요 변경사항
RootLayout추가 (사이드바 +Outlet기반 콘텐츠 영역)Sidebar의 활성 메뉴 판단 방식을 URL 기반(NavLink)으로 전환해RootLayout과 결합 가능하도록 구조 조정src/routes,/login분리)과 페이지별 헤더 배치는 이번 PR 범위에서 제외하고 별도 작업으로 분리📝 작업 내용
RootLayout신규 추가:Sidebar+Outlet조합,children/title/actionLabel등 페이지별 prop 없이 순수 layout route로 설계Sidebarpublic API 변경:activeKey/onNavigate콜백 제거,NavLink기반으로 전환해 현재 URL에서 활성 메뉴 자동 판단 (breaking change)Sidebar메뉴 7개 경로 매핑 추가: 실제 라우팅 등록 전 잠정값이며 라우팅 설계 확정 시 갱신 필요 (코드 주석으로 명시)PageHeader는RootLayout에서 제외: 페이지마다 제목/액션 버튼이 다르고Outlet구조상 콜백 전달이 어려워 각 페이지가 직접 배치하는 구조로 결정Sidebar.test.tsx/Sidebar.stories.tsx를MemoryRouter기반으로 갱신,RootLayout.test.tsx는 중첩Route로Outlet동작 검증RootLayout의 콘텐츠 padding이PageHeader까지 밀어내던 버그 수정,PageHeader기본 배경(bg-fill-normal) 복원 — 실제 브라우저 렌더링으로 발견pnpm exec eslint --quiet,pnpm build통과📸 스크린샷 (선택)
💬 리뷰 요구사항(선택)
Sidebar의activeKey/onNavigate→NavLink전환은 breaking change입니다. 다른 진행 중인 작업에서Sidebar를 참조하고 있다면 충돌 여부 확인 부탁드립니다.Sidebar메뉴 7개의 경로 문자열(/introduction등)은 잠정값입니다. 실제 라우팅 설계 시 이 값을 그대로 쓸지 검토가 필요합니다.Summary by CodeRabbit