Skip to content

[Feat] 루트 레이아웃 구조 설정#20

Open
leemanjae02 wants to merge 4 commits into
mainfrom
feat/root-layout-19
Open

[Feat] 루트 레이아웃 구조 설정#20
leemanjae02 wants to merge 4 commits into
mainfrom
feat/root-layout-19

Conversation

@leemanjae02

@leemanjae02 leemanjae02 commented Jul 14, 2026

Copy link
Copy Markdown
Member

#️⃣ 연관된 이슈

🚧 Work in Progress

  • 작업 진행 중

📌 주요 변경사항

  • 로그인 페이지를 제외한 모든 페이지에 공통 적용할 RootLayout 추가 (사이드바 + Outlet 기반 콘텐츠 영역)
  • Sidebar의 활성 메뉴 판단 방식을 URL 기반(NavLink)으로 전환해 RootLayout과 결합 가능하도록 구조 조정
  • 실제 라우팅 등록(src/routes, /login 분리)과 페이지별 헤더 배치는 이번 PR 범위에서 제외하고 별도 작업으로 분리

📝 작업 내용

  • RootLayout 신규 추가: Sidebar + Outlet 조합, children/title/actionLabel 등 페이지별 prop 없이 순수 layout route로 설계
  • Sidebar public API 변경: activeKey/onNavigate 콜백 제거, NavLink 기반으로 전환해 현재 URL에서 활성 메뉴 자동 판단 (breaking change)
  • Sidebar 메뉴 7개 경로 매핑 추가: 실제 라우팅 등록 전 잠정값이며 라우팅 설계 확정 시 갱신 필요 (코드 주석으로 명시)
  • PageHeaderRootLayout에서 제외: 페이지마다 제목/액션 버튼이 다르고 Outlet 구조상 콜백 전달이 어려워 각 페이지가 직접 배치하는 구조로 결정
  • Sidebar.test.tsx/Sidebar.stories.tsxMemoryRouter 기반으로 갱신, RootLayout.test.tsx는 중첩 RouteOutlet 동작 검증
  • RootLayout의 콘텐츠 padding이 PageHeader까지 밀어내던 버그 수정, PageHeader 기본 배경(bg-fill-normal) 복원 — 실제 브라우저 렌더링으로 발견
  • 검증: 관련 Vitest 전체 통과, pnpm exec eslint --quiet, pnpm build 통과

📸 스크린샷 (선택)

스크린샷 2026-07-14 오후 9 47 12

💬 리뷰 요구사항(선택)

  • SidebaractiveKey/onNavigateNavLink 전환은 breaking change입니다. 다른 진행 중인 작업에서 Sidebar를 참조하고 있다면 충돌 여부 확인 부탁드립니다.
  • Sidebar 메뉴 7개의 경로 문자열(/introduction 등)은 잠정값입니다. 실제 라우팅 설계 시 이 값을 그대로 쓸지 검토가 필요합니다.

Summary by CodeRabbit

  • 새로운 기능
    • 현재 경로에 따라 사이드바 메뉴가 활성화되는 링크 기반 내비게이션을 도입했습니다.
    • 중첩 라우트의 콘텐츠를 사이드바와 함께 보여주는 기본 레이아웃(RootLayout)을 추가했습니다.
  • 스타일 개선
    • 페이지 헤더 배경 기본 스타일이 변경되었습니다.
  • 버그 수정
    • 현재 페이지에 해당하는 메뉴에만 접근성용 상태 표기가 정확히 적용되도록 개선했습니다.

사이드바와 콘텐츠 영역을 조합하고, 로그인 라우트만 제외 적용할 수 있도록
Outlet 기반 layout route로 구성
activeKey/onNavigate 콜백 대신 NavLink로 전환해 RootLayout이 Outlet
기반으로 바뀌어도 별도 상태 전달 없이 현재 경로에서 활성 메뉴를 판단하도록 함.
메뉴별 경로는 실제 라우팅 등록 전 잠정값이며 라우팅 설계 확정 시 갱신 필요
콘텐츠 padding을 main에 직접 주면 Outlet 안에서 페이지가 그리는
PageHeader에도 적용돼 헤더 border-bottom이 안쪽으로 밀리는 문제가 있었음.
padding은 페이지가 직접 콘텐츠 영역에 주도록 하고, PageHeader는 항상
흰 배경을 갖도록 기본값으로 되돌림
@github-actions github-actions Bot changed the title feat: 로그인 제외 페이지 공통 RootLayout 및 Sidebar 라우팅 전환 [Feat] 루트 레이아웃 구조 설정 Jul 14, 2026
@github-actions github-actions Bot added the ✨Feature 새로운 기능 label Jul 14, 2026
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 21597146-bfd6-41e8-8745-a901234cc07d

📥 Commits

Reviewing files that changed from the base of the PR and between b435cb5 and 46c28fe.

📒 Files selected for processing (3)
  • src/components/common/Sidebar/Sidebar.tsx
  • src/index.css
  • src/layout/RootLayout.tsx

📝 Walkthrough

Walkthrough

Sidebar를 수동 상태 기반 버튼에서 React Router의 NavLink 기반 링크로 전환하고, RootLayout에서 사이드바와 중첩 콘텐츠를 배치합니다. 테스트와 스토리는 URL 기반 활성 상태를 검증하며, 사이드바 너비 토큰과 PageHeader 배경 클래스가 추가됩니다.

Changes

사이드바 라우팅 및 레이아웃

Layer / File(s) Summary
사이드바 링크 기반 네비게이션
src/components/common/Sidebar/Sidebar.tsx
메뉴 설정과 props를 path 중심으로 변경하고 NavLink로 링크 및 활성 스타일을 렌더링합니다.
라우팅 테스트와 스토리 설정
src/components/common/Sidebar/Sidebar.test.tsx, src/components/common/Sidebar/Sidebar.stories.tsx
MemoryRouter 기반으로 메뉴 링크의 href, aria-current, 렌더링 및 로그아웃 동작을 검증합니다.
RootLayout과 중첩 라우트 렌더링
src/layout/RootLayout.tsx, src/layout/RootLayout.test.tsx, src/index.css
고정 사이드바와 Outlet 콘텐츠를 배치하고, 사이드바 너비 토큰을 사용해 본문을 배치하며 중첩 경로의 페이지 렌더링과 활성 링크를 테스트합니다.

페이지 헤더 배경 스타일

Layer / File(s) Summary
PageHeader 배경 클래스
src/components/common/PageHeader/PageHeader.tsx
최상위 컨테이너의 기본 클래스에 bg-fill-normal을 추가합니다.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 루트 레이아웃과 사이드바 중심의 구조 변경을 잘 요약해 제목이 변경 사항과 일치합니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/root-layout-19

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.css

File 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

CI 결과

항목 결과
TypeScript 🟢 통과
Prettier 🟢 통과
Generated 🟢 통과
ESLint 🟢 통과
Test 🟢 통과
Build 🟢 통과

@KyeongJooni KyeongJooni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

수고하셨습니다~!!

Comment thread src/layout/RootLayout.tsx Outdated
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]">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

220이 사이드바에서도 재사용 되는거 같은데 상수나 토큰으로 한 곳에서 처리하면 좋을 것 같습니다!!

Sidebar의 너비와 RootLayout의 콘텐츠 좌측 여백에 220px가 각자
하드코딩돼 있어 하나만 바뀌면 어긋날 수 있었음. index.css에
--spacing-sidebar 토큰을 추가해 w-sidebar/pl-sidebar로 공유
@github-actions

Copy link
Copy Markdown

CI 결과

항목 결과
TypeScript 🟢 통과
Prettier 🟢 통과
Generated 🟢 통과
ESLint 🟢 통과
Test 🟢 통과
Build 🟢 통과

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨Feature 새로운 기능

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants