Skip to content

[Feat] #135 - Dialog 컴포넌트 및 카탈로그 구현#137

Open
juri123123 wants to merge 5 commits into
defaultfrom
feat/#135-dialog
Open

[Feat] #135 - Dialog 컴포넌트 및 카탈로그 구현#137
juri123123 wants to merge 5 commits into
defaultfrom
feat/#135-dialog

Conversation

@juri123123

@juri123123 juri123123 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

🌴 PR 요약

🌱 작업한 브랜치

🌱 PR Point

체크박스에 사소한 오류가 있어 함께 수정했습니다.
attributedStringAttributes에 사소한 오류가 있어 함께 수정했습니다.

📌 참고 사항

기분탓인지.. 왜이리 폰트가 피그마와 달리 보일까요

📸 스크린샷

기능 스크린샷
기능이름 Simulator Screen Recording - iPhone 17 Pro - 2026-07-06 at 23 37 07

📮 관련 이슈

@juri123123 juri123123 requested a review from yungu0010 July 6, 2026 14:38
@juri123123 juri123123 self-assigned this Jul 6, 2026
@juri123123 juri123123 added enhancement New feature or request feat labels Jul 6, 2026
@juri123123 juri123123 linked an issue Jul 6, 2026 that may be closed by this pull request
1 task
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

MDSDialog와 Variant 타입이 추가되고, MDSCheckbox와 MDSFont의 공개 API가 확장됨. Storybook에 Dialog 카테고리와 데모 화면이 연결되어 여러 변형의 다이얼로그를 보여주도록 구성됨.

Changes

Dialog 컴포넌트 구현

Layer / File(s) Summary
Checkbox와 Font 지원
MDS/Sources/Components/Control/Checkbox/MDSCheckbox.swift, MDS/Sources/Foundation/MDSFont.swift, MDS/Sources/Components/Button/ActionButton/MDSActionButton.swift
MDSCheckboxtitle이 추가되고 제목 표시 갱신이 연결되며, MDSFontMDSActionButton의 attributed text 생성에 alignment가 반영됨.
Dialog Variant 타입
MDS/Sources/Components/Dialog/MDSDialogType.swift
MDSDialog.Variantdefault, information, danger 케이스로 추가됨.
Dialog 컴포넌트 구현
MDS/Sources/Components/Dialog/MDSDialog.swift
MDSDialog의 초기화, 버튼 콜백, variant별 버튼 구성, 스택뷰 레이아웃, 탭 액션이 추가됨.
Storybook Dialog 데모
MDSStoryBook/MDSStoryBook/Component/ComponentCategoryViewController.swift, MDSStoryBook/MDSStoryBook/Component/Dialog/DialogViewController.swift
Dialog 카테고리 라우팅이 추가되고, DialogViewController가 체크박스 유무 조합의 데모 섹션을 구성함.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Poem

작은 토끼가 다이얼로그를 폴짝 만들었어요
체크박스도 달고, 글자 정렬도 맞췄지요
버튼은 반짝이고, 탭하면 콩 하고 울려요
스토리북에서 여러 얼굴로 인사해요
오늘의 변화, 참 말끔하네요 🐰

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed 직접 이슈 #135의 Dialog 구현 요구를 충족하도록 MDSDialog와 관련 데모 화면이 추가되었습니다.
Out of Scope Changes check ✅ Passed 설명된 다이얼로그 구현을 보완하는 체크박스, 폰트, 버튼 정렬 수정으로 보이며 명백한 무관 변경은 없습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed 다이얼로그 컴포넌트와 카탈로그 구현이라는 핵심 변경을 정확히 요약합니다.
Description check ✅ Passed 체크박스 수정과 attributedStringAttributes 수정, Dialog 구현 내용이 변경사항과 관련됩니다.
✨ 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/#135-dialog

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
MDS/Sources/Components/Control/Checkbox/MDSCheckbox.swift (1)

66-73: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

title 저장 프로퍼티가 init 시점에 동기화되지 않음.

init(size:title:)에서 setTitle(title: title)을 직접 호출하지만 self.title에는 대입하지 않습니다. 따라서 MDSCheckbox(size:, title: "Label")로 생성한 인스턴스는 라벨은 정상 표시되지만, 이후 .title getter를 읽으면 nil이 반환되어 실제 UI 상태와 프로퍼티 값이 불일치합니다.

🐛 제안하는 수정
     public init(size: Size = .large, title: String? = nil) {
         self.checkboxSize = size
         
         super.init(frame: .zero)
         
         setup()
-        setTitle(title: title)
+        self.title = title
     }
🤖 Prompt for 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.

In `@MDS/Sources/Components/Control/Checkbox/MDSCheckbox.swift` around lines 66 -
73, `MDSCheckbox.init(size:title:)` is updating the UI via `setTitle(title:)`
but leaving the stored `title` property unset, so the getter can return nil
after initialization. Update the initializer to synchronize the backing `title`
state before or alongside the existing `setup()` and `setTitle(title:)` calls,
using the `MDSCheckbox` initializer and `title` property as the primary
touchpoints.
🧹 Nitpick comments (2)
MDSStoryBook/MDSStoryBook/Component/Dialog/DialogViewController.swift (1)

13-13: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

dialogs 배열의 목적이 불명확합니다.

dialogs에 append만 되고 다른 곳에서 사용되지 않습니다. 뷰는 이미 뷰 계층(contentStack)에 강한 참조로 유지되므로 이 배열은 불필요해 보입니다.

Also applies to: 106-106

🤖 Prompt for 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.

In `@MDSStoryBook/MDSStoryBook/Component/Dialog/DialogViewController.swift` at
line 13, The private dialogs array in DialogViewController is only appended to
and never read, so it appears to be unnecessary state. Remove the dialogs
storage and update the dialog creation path in addDialog(_: ) and any related
cleanup logic to rely on the contentStack view hierarchy for ownership instead
of keeping a separate array.
MDS/Sources/Components/Dialog/MDSDialog.swift (1)

12-13: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

title/subTitle가 초기화 이후 갱신되지 않습니다.

public var title, public var subTitlesetUI()에서 최초 1회만 titleLabel.text/descriptionLabel.text에 반영됩니다. 이후 외부에서 값을 재할당해도 didSet이 없어 UI가 갱신되지 않습니다. 같은 스택의 MDSCheckbox.titledidSet으로 setTitle을 호출하는 패턴과 일관성이 없습니다.

♻️ 제안하는 수정안
-    public var title: String
-    public var subTitle: String
+    public var title: String {
+        didSet { titleLabel.text = title }
+    }
+    public var subTitle: String {
+        didSet { descriptionLabel.text = subTitle }
+    }

Also applies to: 109-116

🤖 Prompt for 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.

In `@MDS/Sources/Components/Dialog/MDSDialog.swift` around lines 12 - 13,
`MDSDialog`의 `title`과 `subTitle`이 초기 설정 후 변경되어도 UI에 반영되지 않는 문제입니다.
`MDSCheckbox.title`처럼 `MDSDialog`의 `title`/`subTitle`에 `didSet`을 추가해 값이 바뀔 때마다
`titleLabel.text`와 `descriptionLabel.text`가 즉시 갱신되도록 수정하고, 초기 `setUI()`에서도 동일한
반영 로직을 재사용하도록 정리하세요.
🤖 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 `@MDS/Sources/Components/Dialog/MDSDialog.swift`:
- Around line 72-86: disableButton and dangerButton are initialized with
non-lazy let closures that reference self, so their addTarget targets may be
bound incorrectly. Update these properties in MDSDialog to lazy var, matching
primaryButton, and keep the same selector wiring so the targets are resolved
against the instance after initialization.

---

Outside diff comments:
In `@MDS/Sources/Components/Control/Checkbox/MDSCheckbox.swift`:
- Around line 66-73: `MDSCheckbox.init(size:title:)` is updating the UI via
`setTitle(title:)` but leaving the stored `title` property unset, so the getter
can return nil after initialization. Update the initializer to synchronize the
backing `title` state before or alongside the existing `setup()` and
`setTitle(title:)` calls, using the `MDSCheckbox` initializer and `title`
property as the primary touchpoints.

---

Nitpick comments:
In `@MDS/Sources/Components/Dialog/MDSDialog.swift`:
- Around line 12-13: `MDSDialog`의 `title`과 `subTitle`이 초기 설정 후 변경되어도 UI에 반영되지 않는
문제입니다. `MDSCheckbox.title`처럼 `MDSDialog`의 `title`/`subTitle`에 `didSet`을 추가해 값이
바뀔 때마다 `titleLabel.text`와 `descriptionLabel.text`가 즉시 갱신되도록 수정하고, 초기
`setUI()`에서도 동일한 반영 로직을 재사용하도록 정리하세요.

In `@MDSStoryBook/MDSStoryBook/Component/Dialog/DialogViewController.swift`:
- Line 13: The private dialogs array in DialogViewController is only appended to
and never read, so it appears to be unnecessary state. Remove the dialogs
storage and update the dialog creation path in addDialog(_: ) and any related
cleanup logic to rely on the contentStack view hierarchy for ownership instead
of keeping a separate array.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d3577643-1d4a-469a-9710-fcece93979b0

📥 Commits

Reviewing files that changed from the base of the PR and between 81af80f and 603ce5a.

📒 Files selected for processing (6)
  • MDS/Sources/Components/Control/Checkbox/MDSCheckbox.swift
  • MDS/Sources/Components/Dialog/MDSDialog.swift
  • MDS/Sources/Components/Dialog/MDSDialogType.swift
  • MDS/Sources/Foundation/MDSFont.swift
  • MDSStoryBook/MDSStoryBook/Component/ComponentCategoryViewController.swift
  • MDSStoryBook/MDSStoryBook/Component/Dialog/DialogViewController.swift

Comment thread MDS/Sources/Components/Dialog/MDSDialog.swift Outdated

@yungu0010 yungu0010 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.

.font를 사용해 자간과 높이가 적용되지 않아서 그런 것 같아요. setTypography를 사용하시면 피그마와 비슷해보일지도 .. !!
dialog도 옵셔널 값이 4개라서 Input처럼 토글로 카탈로그를 보여줘야할 것 같아요.

리뷰 확인 후 수정 부탁드립니다!

Comment thread MDS/Sources/Foundation/MDSFont.swift Outdated
Comment thread MDS/Sources/Components/Dialog/MDSDialog.swift Outdated
Comment thread MDS/Sources/Components/Dialog/MDSDialog.swift Outdated
Comment thread MDS/Sources/Components/Dialog/MDSDialog.swift
Comment thread MDS/Sources/Components/Dialog/MDSDialog.swift Outdated
Comment thread MDS/Sources/Components/Dialog/MDSDialog.swift Outdated
Comment thread MDS/Sources/Components/Dialog/MDSDialog.swift
Comment thread MDS/Sources/Components/Dialog/MDSDialog.swift Outdated

@yungu0010 yungu0010 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.

컴포넌트 내 옵셔널 여부는 오른쪽 사이드바 참고하시거나 컴포넌트 클릭 후 옵셔널 버튼 -> 외부 영역으로 드래그 하면 확인하실 수 있습니다~!

return button
}()

public init(

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.

저희 버튼 이미지(prefix icon, suffix icon)도 옵셔널이어서 생성자 주입으로 4개 더 추가해주세요!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
MDS/Sources/Components/Dialog/MDSDialog.swift (1)

138-141: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

체크박스 간격이 variant와 무관하게 항상 24px로 고정되어 있습니다.

이전 리뷰에서 Danger variant의 체크박스 간격은 8px이어야 한다는 디자인 확인이 있었지만, 현재 코드는 checkBox가 있으면 variant에 상관없이 setCustomSpacing(24, after: descriptionLabel)을 적용합니다.

-        if let checkBox {
-            stackView.setCustomSpacing(24, after: descriptionLabel)
-            stackView.addArrangedSubview(checkBox)
-        }
+        if let checkBox {
+            let spacing: CGFloat = variant.isDanger ? 8 : 24
+            stackView.setCustomSpacing(spacing, after: descriptionLabel)
+            stackView.addArrangedSubview(checkBox)
+        }

Based on past review discussion, "Danger에는 8px로 되어있어서... 8px로 맞춰달라고 하십니당" — variant별 분기가 필요한지 확인 부탁드립니다.

🤖 Prompt for 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.

In `@MDS/Sources/Components/Dialog/MDSDialog.swift` around lines 138 - 141, The
checkbox spacing in MDSDialog is hardcoded to 24px regardless of variant, so
update the checkBox handling to apply variant-specific spacing instead. Use the
existing variant state in MDSDialog to branch the stackView.setCustomSpacing
call so Danger uses 8px while the other variants keep the intended spacing, and
keep the change localized to the checkBox block.
🤖 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 `@MDS/Sources/Components/Dialog/MDSDialog.swift`:
- Around line 12-14: `MDSDialog` still treats the dialog description as
required, but it should be optional again. Update the `MDSDialog` stored
property currently named `subTitle` and the corresponding `init` parameter
`description` to be optional, then propagate that optionality through any usage
in the dialog content setup so dialogs can be created without description text.
Also check the related code paths around the referenced uses in the diff to
ensure they compile with the optional type.

---

Duplicate comments:
In `@MDS/Sources/Components/Dialog/MDSDialog.swift`:
- Around line 138-141: The checkbox spacing in MDSDialog is hardcoded to 24px
regardless of variant, so update the checkBox handling to apply variant-specific
spacing instead. Use the existing variant state in MDSDialog to branch the
stackView.setCustomSpacing call so Danger uses 8px while the other variants keep
the intended spacing, and keep the change localized to the checkBox block.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fbe11b1e-f255-4d99-bf25-600c07966b68

📥 Commits

Reviewing files that changed from the base of the PR and between 603ce5a and ad86e48.

📒 Files selected for processing (4)
  • MDS/Sources/Components/Button/ActionButton/MDSActionButton.swift
  • MDS/Sources/Components/Dialog/MDSDialog.swift
  • MDS/Sources/Foundation/MDSFont.swift
  • MDSStoryBook/MDSStoryBook/Component/Dialog/DialogViewController.swift
🚧 Files skipped from review as they are similar to previous changes (2)
  • MDS/Sources/Foundation/MDSFont.swift
  • MDSStoryBook/MDSStoryBook/Component/Dialog/DialogViewController.swift

Comment on lines +12 to +14
private let title: String
private let subTitle: String
private let checkBox: MDSCheckbox?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

description가 다시 필수(non-optional)로 되어 있습니다.

이전 리뷰에서 디자이너 확인 결과 description은 옵셔널이 맞다고 결론났고 작성자도 수정하겠다고 답변했으나, 현재 initdescription: Stringprivate let subTitle: String이 모두 non-optional로 남아있습니다. 설명 텍스트가 없는 다이얼로그를 구성할 수 없는 상태입니다.

🔧 옵셔널로 되돌리는 예시
-    private let subTitle: String
+    private let subTitle: String?
...
     public init(
         variant: Variant,
         title: String,
-        description: String,
+        description: String? = nil,
         checkbox: MDSCheckbox? = nil
     ) {
...
-        descriptionLabel.text = subTitle
+        descriptionLabel.text = subTitle
+        descriptionLabel.isHidden = subTitle == nil

Based on past review discussion, "문의 결과 옵셔널이 맞다고 합니다" — 확인 부탁드립니다.

Also applies to: 85-97, 109-110

🤖 Prompt for 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.

In `@MDS/Sources/Components/Dialog/MDSDialog.swift` around lines 12 - 14,
`MDSDialog` still treats the dialog description as required, but it should be
optional again. Update the `MDSDialog` stored property currently named
`subTitle` and the corresponding `init` parameter `description` to be optional,
then propagate that optionality through any usage in the dialog content setup so
dialogs can be created without description text. Also check the related code
paths around the referenced uses in the diff to ensure they compile with the
optional type.

@yungu0010 yungu0010 changed the title [Feat] #135 - dialog [Feat] #135 - Dialog 컴포넌트 및 카탈로그 구현 Jul 8, 2026
@yungu0010 yungu0010 linked an issue Jul 8, 2026 that may be closed by this pull request
1 task
@yungu0010 yungu0010 self-requested a review July 8, 2026 23:47

@yungu0010 yungu0010 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.

수정사항 확인했습니다👍
코드래빗이 남긴 description 옵셔널 부분이랑 버튼 이미지(prefix, suffix 2종류) 삽입, 카탈로그 토글로 변경(또는 description 없는 버전도 추가) 작업이 남은 것 같아요!
세 개 작업 후 머지 부탁드립니다~~!

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

Labels

enhancement New feature or request feat

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] Dialog 카탈로그 구현 [Feat] Dialog 구현

2 participants