Skip to content

feat: 버튼 스타일 추가#117

Merged
doyeonk429 merged 2 commits into
developfrom
BOOK-173-feature/#110
Jul 30, 2025
Merged

feat: 버튼 스타일 추가#117
doyeonk429 merged 2 commits into
developfrom
BOOK-173-feature/#110

Conversation

@doyeonk429
Copy link
Copy Markdown
Member

@doyeonk429 doyeonk429 commented Jul 29, 2025

🔗 관련 이슈

📘 작업 유형

  • ✨ Feature (기능 추가)
  • 🐞 Bugfix (버그 수정)
  • 🔧 Refactor (코드 리팩토링)
  • ⚙️ Chore (환경 설정)
  • 📝 Docs (문서 작성 및 수정)
  • ✅ Test (기능 테스트)
  • 🎨 style (코드 스타일 수정)

📙 작업 내역

  • stroke 버튼 스타일 추가

🧪 테스트 내역

  • 브라우저/기기에서 동작 확인
  • 엣지 케이스 테스트 완료
  • 기존 기능 영향 없음

🎨 스크린샷 또는 시연 영상 (선택)

Simulator Screenshot - ReedDefaultSize - 2025-07-30 at 00 34 20

✅ PR 체크리스트

  • 커밋 메시지가 명확합니다
  • PR 제목이 컨벤션에 맞습니다
  • 관련 이슈 번호를 작성했습니다
  • 기능이 정상적으로 작동합니다
  • 불필요한 코드를 제거했습니다

💬 추가 설명 or 리뷰 포인트 (선택)

  • ..

Summary by CodeRabbit

  • 신규 기능

    • 새로운 버튼 스타일 "Stroke"가 추가되어, 테두리가 강조된 버튼을 사용할 수 있습니다.
    • "Stroke" 스타일의 버튼은 활성화 및 비활성화 상태 모두에서 제공됩니다.
  • 버그 수정

    • "Stroke" 스타일 버튼의 외곽선 색상과 두께가 버튼 상태에 따라 올바르게 표시됩니다.
  • 기타

    • 버튼 구성 옵션에 "Stroke" 스타일 지원이 추가되었습니다.
    • 버튼 스타일 관련 설정의 유연성이 향상되었습니다.
    • 버튼 크기별 높이가 소폭 조정되어 UI 일관성이 개선되었습니다.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jul 29, 2025

"""

Walkthrough

버튼 컴포넌트에 새로운 스타일 "Stroke"가 추가되었습니다. 이에 따라 버튼 스타일, 구성, 색상, 뷰 컨트롤러에 관련 코드가 확장되었으며, 활성/비활성 상태 및 다양한 크기에서 Stroke 스타일 버튼이 생성될 수 있도록 구현이 보완되었습니다.

Changes

Cohort / File(s) Change Summary
Stroke 스타일 추가
src/Projects/BKDesign/Sources/Components/Button/BKButtonStyle.swift
BKButtonStyle enum에 stroke 케이스 추가 및 관련 색상 반환 로직 확장
Stroke 스타일 버튼의 색상 및 테두리 처리
src/Projects/BKDesign/Sources/Components/Button/BKButton.swift
.stroke 스타일일 때 활성화 상태에 따라 테두리 색상 및 두께 설정 로직 추가
버튼 구성 구조체 확장
src/Projects/BKDesign/Sources/Components/Button/BKButtonConfiguration.swift
hasStroke 프로퍼티 추가, 이니셜라이저 및 modifier 메소드 반환 타입을 Self로 변경
Stroke 버튼 뷰 컨트롤러 적용
src/Projects/BKDesign/PreviewApp/Sources/View/BKButtonTestViewController.swift
Stroke 스타일 버튼(활성/비활성) 생성 및 추가, 비활성 버튼 생성 전용 메소드 도입
버튼 크기 높이 조정
src/Projects/BKDesign/Sources/Components/Button/BKButtonSize.swift
.small, .rounded, .medium 버튼 크기 높이 소폭 감소

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant BKButtonTestViewController
    participant BKButton
    participant BKButtonConfiguration

    User->>BKButtonTestViewController: 버튼 뷰 로드
    BKButtonTestViewController->>BKButton: addButton/addDisabledButton 호출 (style: .stroke)
    BKButton->>BKButtonConfiguration: 구성 생성(hasStroke 등)
    BKButton->>BKButton: updateColors() 호출
    BKButton-->>BKButton: 스타일 및 상태에 따라 테두리/색상 설정
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Assessment against linked issues

Objective Addressed Explanation
버튼 컴포넌트에 추가된 스타일 구현 (#110)
Task1, Task2 (#110) 세부 작업(Task1, Task2) 명시적 내용이 없어 직접적 확인 불가

Assessment against linked issues: Out-of-scope changes

(해당 변경사항 중 범위를 벗어난 코드 변경은 발견되지 않았습니다.)
"""

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9b8c50d and 7ff20dc.

📒 Files selected for processing (1)
  • src/Projects/BKDesign/Sources/Components/Button/BKButtonSize.swift (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/Projects/BKDesign/Sources/Components/Button/BKButtonSize.swift
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch BOOK-173-feature/#110

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or @coderabbitai 요약 to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/Projects/BKDesign/Sources/Components/Button/BKButton.swift (1)

213-213: 조건문을 더 관용적인 Swift 스타일로 개선하세요.

isDisabled == false 대신 !isDisabled를 사용하는 것이 더 일반적인 Swift 코딩 스타일입니다.

-        if style == .stroke && isDisabled == false {
+        if style == .stroke && !isDisabled {
src/Projects/BKDesign/Sources/Components/Button/BKButtonConfiguration.swift (1)

60-60: hasStroke 속성 초기화를 단순화하세요.

불필요한 삼항 연산자를 제거하여 코드를 더 간결하게 만들 수 있습니다.

-        self.hasStroke = style == .stroke ? true : false
+        self.hasStroke = style == .stroke
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b01fe36 and 9b8c50d.

📒 Files selected for processing (4)
  • src/Projects/BKDesign/PreviewApp/Sources/View/BKButtonTestViewController.swift (2 hunks)
  • src/Projects/BKDesign/Sources/Components/Button/BKButton.swift (1 hunks)
  • src/Projects/BKDesign/Sources/Components/Button/BKButtonConfiguration.swift (2 hunks)
  • src/Projects/BKDesign/Sources/Components/Button/BKButtonStyle.swift (3 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: doyeonk429
PR: YAPP-Github/Reed-iOS#68
File: src/Projects/BKDesign/PreviewApp/Sources/View/BKButtonTestViewController.swift:124-133
Timestamp: 2025-07-10T08:21:49.399Z
Learning: doyeonk429는 테스트 전용으로만 사용되는 extension이나 코드는 해당 테스트 파일에 그대로 두는 것을 선호합니다. 실제 프로덕션 코드에서 사용되지 않는 테스트 전용 코드는 별도 파일로 분리하지 않고 테스트 파일 내에 유지하는 것이 그들의 코드 구성 방식입니다.
Learnt from: doyeonk429
PR: YAPP-Github/Reed-iOS#98
File: src/Projects/BKPresentation/Sources/AuthFlow/View/TermsView.swift:78-85
Timestamp: 2025-07-22T05:37:28.756Z
Learning: doyeonk429는 Reed-iOS 프로젝트에서 더미 데이터나 테스트 데이터의 구체적인 내용(예: URL 주소)에 대해서는 리뷰 시 지적하지 않기를 선호한다. 더미 데이터는 임시적이며 실제 기능 구현 시 교체될 예정이므로 URL의 구체적인 주소는 중요하지 않다고 본다.
Learnt from: doyeonk429
PR: YAPP-Github/Reed-iOS#63
File: src/Projects/BKDesign/Sources/Extensions/UIColor+.swift:38-48
Timestamp: 2025-07-08T17:17:40.046Z
Learning: doyeonk429는 BKDesign 프로젝트에서 다크모드 지원 코드를 미래를 위한 사전 준비 코드로 구현하고 있다. 현재 다크모드 디자인이 없어서 모든 다크모드 분기에서 라이트모드 색상을 반환하도록 의도적으로 구현했으며, 나중에 다크모드 디자인이 완성되면 해당 케이스만 구현하면 되는 구조로 설계했다.
Learnt from: doyeonk429
PR: YAPP-Github/Reed-iOS#98
File: src/Projects/BKPresentation/Sources/AuthFlow/View/TermsViewController.swift:3-5
Timestamp: 2025-07-22T05:39:10.746Z
Learning: doyeonk429는 Reed-iOS 프로젝트에서 UI 구현 단계에서 미래의 기능 연결을 위해 필요한 import들을 미리 추가해두는 방식을 선호한다. 현재 사용되지 않더라도 곧 사용될 예정인 라이브러리들은 제거하지 않고 유지하는 것을 원한다.
Learnt from: doyeonk429
PR: YAPP-Github/Reed-iOS#68
File: src/Projects/BKDesign/PreviewApp/Sources/View/BKButtonTestViewController.swift:0-0
Timestamp: 2025-07-10T08:21:44.204Z
Learning: doyeonk429는 BKDesign PreviewApp의 테스트 파일에서 주석 처리된 코드를 의도적으로 남겨두어 쉽게 테스트 구성을 전환할 수 있도록 구현한다. 이는 개발 편의성을 위한 것으로, 테스트 파일에서는 일반적인 "주석 처리된 코드 제거" 규칙을 적용하지 않는다.
Learnt from: doyeonk429
PR: YAPP-Github/Reed-iOS#105
File: src/Projects/BKPresentation/Sources/TabBarFlow/BottomTabBarController.swift:24-30
Timestamp: 2025-07-24T13:00:59.096Z
Learning: doyeonk429는 BottomTabBarController에서 viewDidLayoutSubviews의 레이어 재생성 방식을 유지하기를 선호합니다. 탭바에서는 레이아웃 변경 케이스가 거의 없기 때문에 성능 최적화보다는 현재의 단순한 구현 방식이 더 적합하다고 판단합니다.
src/Projects/BKDesign/Sources/Components/Button/BKButton.swift (1)

Learnt from: doyeonk429
PR: #63
File: src/Projects/BKDesign/Sources/Extensions/UIColor+.swift:50-92
Timestamp: 2025-07-08T17:17:37.703Z
Learning: BKDesign 프로젝트에서 UIColor+ 확장의 시맨틱 컬러 메서드들(.bkContentColor, .bkBorderColor, .bkDividerColor, .bkBaseColor)이 현재 다크 모드에서도 라이트 모드 색상을 반환하는 것은 의도적인 구현입니다. 아직 다크 모드가 구현되지 않았지만, 미래의 다크 모드 지원을 위한 코드 구조로 준비되어 있습니다.

src/Projects/BKDesign/Sources/Components/Button/BKButtonStyle.swift (1)

Learnt from: doyeonk429
PR: #63
File: src/Projects/BKDesign/Sources/Extensions/UIColor+.swift:50-92
Timestamp: 2025-07-08T17:17:37.703Z
Learning: BKDesign 프로젝트에서 UIColor+ 확장의 시맨틱 컬러 메서드들(.bkContentColor, .bkBorderColor, .bkDividerColor, .bkBaseColor)이 현재 다크 모드에서도 라이트 모드 색상을 반환하는 것은 의도적인 구현입니다. 아직 다크 모드가 구현되지 않았지만, 미래의 다크 모드 지원을 위한 코드 구조로 준비되어 있습니다.

src/Projects/BKDesign/PreviewApp/Sources/View/BKButtonTestViewController.swift (3)

Learnt from: doyeonk429
PR: #63
File: src/Projects/BKDesign/Sources/Extensions/UIColor+.swift:50-92
Timestamp: 2025-07-08T17:17:37.703Z
Learning: BKDesign 프로젝트에서 UIColor+ 확장의 시맨틱 컬러 메서드들(.bkContentColor, .bkBorderColor, .bkDividerColor, .bkBaseColor)이 현재 다크 모드에서도 라이트 모드 색상을 반환하는 것은 의도적인 구현입니다. 아직 다크 모드가 구현되지 않았지만, 미래의 다크 모드 지원을 위한 코드 구조로 준비되어 있습니다.

Learnt from: doyeonk429
PR: #68
File: src/Projects/BKDesign/Sources/Components/Button/BKButtonGroup.swift:86-92
Timestamp: 2025-07-10T08:21:16.126Z
Learning: BKButtonGroup의 horizontal 레이아웃에서 stackView.distribution을 .fillProportionally로 설정한 것은 의도된 디자인입니다. doyeonk429는 버튼들이 콘텐츠 길이에 따라 다른 너비를 가지는 것을 선호합니다.

Learnt from: clxxrlove
PR: #80
File: src/Projects/BKDesign/Sources/Components/BottomSheet/BKBottomSheetViewController.swift:148-148
Timestamp: 2025-07-14T05:23:04.937Z
Learning: Reed-iOS 프로젝트의 BKBottomSheetViewController에서 버튼 영역 높이(84)는 디자인 시스템에 기반한 의도적인 고정값입니다. clxxrlove에 따르면 작은 기기에서도 동일한 크기가 유지되어야 하며, 동적 계산보다는 상수화만 필요합니다.

🧬 Code Graph Analysis (2)
src/Projects/BKDesign/Sources/Components/Button/BKButton.swift (1)
src/Projects/BKDesign/Sources/Components/Button/BKButtonStyle.swift (1)
  • color (123-129)
src/Projects/BKDesign/Sources/Components/Button/BKButtonStyle.swift (1)
src/Projects/BKDesign/Sources/Extensions/UIColor+.swift (3)
  • bkBaseColor (91-102)
  • bkBackgroundColor (38-50)
  • bkContentColor (52-63)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (7)
src/Projects/BKDesign/Sources/Components/Button/BKButton.swift (1)

214-220: 테두리 스타일링 로직이 올바르게 구현되었습니다.

stroke 스타일에 대한 테두리 색상과 두께 설정이 적절하며, 다른 스타일에서는 테두리를 제거하는 로직도 정확합니다. 현재 버튼 상태에 따른 색상 처리도 올바릅니다.

src/Projects/BKDesign/Sources/Components/Button/BKButtonStyle.swift (3)

19-20: 새로운 stroke 스타일 케이스가 적절히 추가되었습니다.

주석과 함께 명확하게 정의되어 있으며, 기존 스타일들과 일관된 네이밍을 따르고 있습니다.


51-56: stroke 스타일의 배경색 정의가 적절합니다.

투명한 배경을 위해 .bkBaseColor(.primary)를 사용하고, 비활성 상태에서는 표준 비활성 배경색을 사용하는 것이 stroke 버튼의 디자인 패턴에 부합합니다.


89-94: stroke 스타일의 전경색 정의가 일관성 있게 구현되었습니다.

브랜드 색상을 활용한 텍스트 및 테두리 색상 설정이 tertiary 스타일과 일관되며, 비활성 상태 처리도 적절합니다.

src/Projects/BKDesign/PreviewApp/Sources/View/BKButtonTestViewController.swift (2)

61-62: stroke 스타일 버튼 테스트 케이스가 적절히 추가되었습니다.

활성화된 버튼과 비활성화된 버튼 모두 테스트할 수 있도록 구성되어 있어, stroke 스타일의 모든 상태를 검증할 수 있습니다.


77-82: 비활성화된 버튼 테스트를 위한 헬퍼 메서드가 잘 구현되었습니다.

기존 addButton 메서드와 일관된 패턴을 따르면서, 비활성화 상태 테스트를 위한 명확한 역할을 수행합니다. 테스트 전용 코드를 테스트 파일 내에 유지하는 방식도 적절합니다.

src/Projects/BKDesign/Sources/Components/Button/BKButtonConfiguration.swift (1)

66-66: 반환 타입을 Self로 변경한 것이 좋은 개선사항입니다.

이 변경으로 서브클래싱과 프로토콜 준수에 대한 유연성이 향상되며, API가 더 제네릭하고 재사용 가능해집니다. 모든 modifier 메서드에 일관되게 적용된 점도 우수합니다.

Also applies to: 73-73, 80-80, 87-87, 94-94, 101-101, 108-108

Copy link
Copy Markdown
Member

@clxxrlove clxxrlove left a comment

Choose a reason for hiding this comment

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

BKButtonSize에 대해서도 수정이 있어야 할 거 같아요.
수고하셨습니다 !

@doyeonk429
Copy link
Copy Markdown
Member Author

@clxxrlove 버튼 사이즈 수정 어디서 필요할까요? 새로 추가되는 피그마 디자인에는 버튼 사이즈 관련한 변경사항이 안보입니다.

@clxxrlove
Copy link
Copy Markdown
Member

@clxxrlove 버튼 사이즈 수정 어디서 필요할까요? 새로 추가되는 피그마 디자인에는 버튼 사이즈 관련한 변경사항이 안보입니다.

컴포넌트랑 지금 사이즈가 안 맞아요. 높이만 봤을 때

var height: CGFloat {
    switch self {
    case .small, .rounded:
        40
    case .medium:
        48
    case .large:
        52
    }
}

인데, 실제 사이즈는 52/48/46/44/38이에요.
새로 추가되는 피그마 디자인의 경우에는 독서 기록에 있는 버튼들이 38이에요.

@doyeonk429
Copy link
Copy Markdown
Member Author

doyeonk429 commented Jul 30, 2025

@clxxrlove 디자인시스템 상으로는 버튼 사이즈가 52/46(변경된거같음)/38(변경된거같음) 이렇게 2개만 있는데요. 이 고정값은 반영하되, 다른 사이즈 대응 가능하게 커스텀 형식 하나 추가하는걸로 변경하겠습니다. 괜찮을까요?

@clxxrlove
Copy link
Copy Markdown
Member

@clxxrlove 디자인시스템 상으로는 버튼 사이즈가 52/46(변경된거같음)/38(변경된거같음) 이렇게 2개만 있는데요. 이 고정값은 반영하되, 다른 사이즈 대응 가능하게 커스텀 형식 하나 추가하는걸로 변경하겠습니다. 괜찮을까요?

네넵

@doyeonk429
Copy link
Copy Markdown
Member Author

@clxxrlove 디자인시스템 상으로는 버튼 사이즈가 52/46(변경된거같음)/38(변경된거같음) 이렇게 2개만 있는데요. 이 고정값은 반영하되, 다른 사이즈 대응 가능하게 커스텀 형식 하나 추가하는걸로 변경하겠습니다. 괜찮을까요?

네넵

요거 커스텀 사이즈 대응은 제외하고 구현했습니다.

@doyeonk429 doyeonk429 merged commit 254eeba into develop Jul 30, 2025
3 checks passed
@doyeonk429 doyeonk429 deleted the BOOK-173-feature/#110 branch July 30, 2025 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BOOK-173/feat] 버튼 컴포넌트 추가 케이스 구현

2 participants