-
Notifications
You must be signed in to change notification settings - Fork 0
feat: #27 chipComponent 구현 #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,43 @@ | ||||||||||||||||||||
| // | ||||||||||||||||||||
| // MissionCard.swift | ||||||||||||||||||||
| // Cherrish-iOS | ||||||||||||||||||||
| // | ||||||||||||||||||||
| // Created by sumin Kong on 1/11/26. | ||||||||||||||||||||
| // | ||||||||||||||||||||
|
|
||||||||||||||||||||
| import SwiftUI | ||||||||||||||||||||
|
|
||||||||||||||||||||
| struct MissionCard: View { | ||||||||||||||||||||
|
|
||||||||||||||||||||
| let missionText: String | ||||||||||||||||||||
| @Binding var isSelected: Bool | ||||||||||||||||||||
|
|
||||||||||||||||||||
| var body: some View { | ||||||||||||||||||||
| VStack(alignment: .leading) { | ||||||||||||||||||||
|
|
||||||||||||||||||||
| HStack { | ||||||||||||||||||||
| Spacer() | ||||||||||||||||||||
| Image(isSelected ? "radiobtn_selected" : "radiobtn_default") | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Spacer() | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Text(missionText) | ||||||||||||||||||||
| .typography(.body1_m_14) | ||||||||||||||||||||
| .foregroundStyle(isSelected ? .gray800 : .gray700) | ||||||||||||||||||||
| .padding(.leading, 8) | ||||||||||||||||||||
| .padding(.bottom, 6) | ||||||||||||||||||||
| } | ||||||||||||||||||||
| .padding(.horizontal, 7) | ||||||||||||||||||||
| .padding(.vertical, 6) | ||||||||||||||||||||
| .frame(width: 148, height: 80) | ||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial SelectionChip과 동일한 고정 크기 프레임 문제.
🤖 Prompt for AI Agents |
||||||||||||||||||||
| .background(isSelected ? .red200 : .gray0) | ||||||||||||||||||||
| .overlay( | ||||||||||||||||||||
| RoundedRectangle(cornerRadius: 10) | ||||||||||||||||||||
| .stroke(isSelected ? .red500 : .gray500, lineWidth: 1) | ||||||||||||||||||||
| ) | ||||||||||||||||||||
| .onTapGesture { | ||||||||||||||||||||
| isSelected.toggle() | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
Comment on lines
+35
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial SelectionChip과 코드 중복이 있습니다.
♻️ 제안하는 리팩토링 예시공통 스타일을 ViewModifier로 추출: struct SelectableChipStyle: ViewModifier {
let isSelected: Bool
func body(content: Content) -> some View {
content
.frame(width: 148, height: 80)
.background(isSelected ? .red200 : .gray0)
.cornerRadius(10)
.overlay(
RoundedRectangle(cornerRadius: 10)
.stroke(isSelected ? .red500 : .gray500, lineWidth: 1)
)
}
}
extension View {
func selectableChipStyle(isSelected: Bool) -> some View {
modifier(SelectableChipStyle(isSelected: isSelected))
}
}그런 다음 각 컴포넌트에서 사용: // MissionCard에서
var body: some View {
VStack(alignment: .leading) {
// ... content
}
.selectableChipStyle(isSelected: isSelected)
.onTapGesture {
isSelected.toggle()
}
}🤖 Prompt for AI Agents
Comment on lines
+39
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major 접근성 지원을 추가하세요.
♻️ 제안하는 수정 .onTapGesture {
isSelected.toggle()
}
+ .accessibilityLabel(missionText)
+ .accessibilityAddTraits(isSelected ? [.isButton, .isSelected] : .isButton)
+ .accessibilityHint("미션 카드를 선택하려면 탭하세요")
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,29 @@ | ||||||||||||||||||||
| // | ||||||||||||||||||||
| // SelectionChip.swift | ||||||||||||||||||||
| // Cherrish-iOS | ||||||||||||||||||||
| // | ||||||||||||||||||||
| // Created by sumin Kong on 1/11/26. | ||||||||||||||||||||
| // | ||||||||||||||||||||
|
|
||||||||||||||||||||
| import SwiftUI | ||||||||||||||||||||
|
|
||||||||||||||||||||
| struct SelectionChip: View { | ||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial 접근 제어자를 명시적으로 선언하세요. 컴포넌트의 접근 제어자가 명시되지 않아 기본적으로 ♻️ 제안하는 수정-struct SelectionChip: View {
+public struct SelectionChip: View {📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
|
|
||||||||||||||||||||
| let title: String | ||||||||||||||||||||
| @Binding var isSelected: Bool | ||||||||||||||||||||
|
|
||||||||||||||||||||
| var body: some View { | ||||||||||||||||||||
| Text(title) | ||||||||||||||||||||
| .typography(.body1_m_14) | ||||||||||||||||||||
| .foregroundStyle(isSelected ? .gray800 : .gray700) | ||||||||||||||||||||
| .frame(width: 148, height: 80) | ||||||||||||||||||||
| .background(isSelected ? .red200 : .gray0) | ||||||||||||||||||||
| .overlay( | ||||||||||||||||||||
| RoundedRectangle(cornerRadius: 10) | ||||||||||||||||||||
| .stroke(isSelected ? .red500 : .gray500, lineWidth: 1) | ||||||||||||||||||||
| ) | ||||||||||||||||||||
| .onTapGesture { | ||||||||||||||||||||
| isSelected.toggle() | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
Comment on lines
+25
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major 접근성 지원을 추가하세요. 컴포넌트에 접근성 레이블과 힌트가 없어 VoiceOver 사용자가 컴포넌트의 상태와 목적을 이해하기 어렵습니다. ♻️ 제안하는 수정 .onTapGesture {
isSelected.toggle()
}
+ .accessibilityLabel(title)
+ .accessibilityAddTraits(isSelected ? .isSelected : [])
+ .accessibilityHint("탭하여 선택 상태를 전환합니다")
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
접근 제어자를 명시적으로 선언하세요.
SelectionChip과 마찬가지로, 재사용 가능한 컴포넌트의 접근 수준을 명확히 하기 위해public또는internal을 명시적으로 선언하세요.♻️ 제안하는 수정
📝 Committable suggestion
🤖 Prompt for AI Agents