Conversation
장식용 빈 요소라는 컴포넌트 계약을 명확히 하기 위해 children과 aria-hidden 속성을 외부 props에서 제외했습니다.
버튼 variant와 size, disabled 및 loading 상태를 공통화했습니다. 아이콘 전용 버튼의 접근성 이름을 타입으로 강제하고 native button의 기본 동작과 확장 가능한 className을 제공합니다.
페이지 이동과 사용자 동작의 의미를 분리하기 위해 버튼형 링크를 추가했습니다. 내부 링크는 Next.js Link를 사용하고 외부 링크는 명시적인 external 속성으로 anchor를 렌더링합니다. disabled와 loading 상태에서는 이동과 이벤트 전파를 차단합니다.
Button의 variant, size, loading, disabled, iconOnly 상태를 문서화했습니다. LinkButton의 내부 경로와 외부 GitHub 이동 예제를 함께 추가했습니다.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🧪 테스트 결과
|
🚦 CI 검증 결과
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Walkthrough
ChangesButton 공통 컴포넌트 시스템
Sequence Diagram(s)sequenceDiagram
participant 호출자
participant Button
participant ButtonContent
participant Spinner
호출자->>Button: variant, size, isLoading, disabled, iconOnly 전달
Button->>Button: isLoading 또는 disabled → disabled 속성 설정
Button->>Button: isLoading=true → aria-busy=true, data-loading=true 설정
Button->>Button: iconOnly=true → size를 'icon'으로 재해석
Button->>ButtonContent: children, isLoading 전달
alt isLoading=true
ButtonContent->>Spinner: 렌더링 (aria-hidden=true)
ButtonContent->>ButtonContent: sr-only로 children 렌더링 (접근성 유지)
else isLoading=false
ButtonContent->>ButtonContent: children 그대로 렌더링
end
sequenceDiagram
participant 호출자
participant LinkButton
participant ButtonContent
호출자->>LinkButton: href, external, disabled, isLoading, variant 전달
alt external=true
LinkButton->>LinkButton: native a 태그 준비
LinkButton->>LinkButton: target=_blank → rel=noopener noreferrer 계산
else external=false
LinkButton->>LinkButton: Next.js Link 준비 (prefetch, replace, onNavigate 허용)
end
alt disabled 또는 isLoading
LinkButton->>LinkButton: onClick 차단, tabIndex=-1, aria-disabled 설정
end
LinkButton->>ButtonContent: children, isLoading 전달
ButtonContent-->>LinkButton: 렌더링 결과 반환
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/shared/ui/button/LinkButton.tsx`:
- Line 85: The `safeRel` assignment in LinkButton is overwriting the `rel` prop
entirely with 'noopener noreferrer' when target equals '_blank', which causes
any existing rel values like 'nofollow' or 'sponsored' provided by the caller to
be lost. Instead of replacing the rel value, merge it with 'noopener noreferrer'
by splitting the existing rel into tokens, adding 'noopener' and 'noreferrer' to
the set of tokens (avoiding duplicates), and then joining them back together
with spaces when target is '_blank'. When target is not '_blank', keep the
original rel value unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b5660391-89d5-4bdc-9f51-5caba6efeafd
📒 Files selected for processing (10)
src/shared/styles/globals.csssrc/shared/ui/button/Button.stories.tsxsrc/shared/ui/button/Button.tsxsrc/shared/ui/button/Button.types.tssrc/shared/ui/button/ButtonContent.tsxsrc/shared/ui/button/LinkButton.tsxsrc/shared/ui/button/buttonVariants.tssrc/shared/ui/button/index.tssrc/shared/ui/spinner/Spinner.tsxsrc/shared/ui/spinner/index.ts
💤 Files with no reviewable changes (1)
- src/shared/styles/globals.css
새 창 링크에서 호출자가 전달한 rel 값을 보존하면서 noopener와 noreferrer를 중복 없이 추가하도록 수정했습니다.
#️⃣연관된 이슈
체크 사항
📝작업내용
Button 공통 컴포넌트
primary,secondary,ghost,outlinevariant를 구현했습니다.sm,md,lg,iconsize를 지원합니다.className을 통한 스타일 확장을 지원합니다.aria-label을 타입으로 강제했습니다.LinkButton 컴포넌트
Button과 페이지를 이동하는LinkButton을 분리했습니다.Link로 렌더링합니다.externalprop을 통해 네이티브a요소로 렌더링합니다.prefetch,replace,onNavigate를 지원합니다.target="_blank"사용 시noopener noreferrer를 적용했습니다.Spinner 및 접근성
children,aria-hidden외부 변경을 타입으로 제한했습니다.aria-busy를 적용했습니다.aria-disabled와tabIndex처리를 추가했습니다.Storybook
스크린샷 (선택)
추가한 라이브러리 (선택)
💬리뷰 요구사항(선택)
Summary by CodeRabbit
:disabled기반으로 개선