-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/#29 TextBox 구현 #55
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
71f0318
f019085
21d4086
dc4331d
bc49e93
24c4e0c
0d6ec00
45b7a30
12a754c
ae92577
4abd912
4eed1aa
9dae48f
820489e
4f90b9f
d34e475
fd51870
35bb6cb
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,26 @@ | ||||||||||||||||||||
| // | ||||||||||||||||||||
| // AgeTextBox.swift | ||||||||||||||||||||
| // Cherrish-iOS | ||||||||||||||||||||
| // | ||||||||||||||||||||
| // Created by 어재선 on 1/13/26. | ||||||||||||||||||||
| // | ||||||||||||||||||||
|
|
||||||||||||||||||||
| import SwiftUI | ||||||||||||||||||||
|
|
||||||||||||||||||||
| struct CherrishTextBox: View { | ||||||||||||||||||||
| var title: String | ||||||||||||||||||||
| @Binding var text: String | ||||||||||||||||||||
| let placeholder: String | ||||||||||||||||||||
|
|
||||||||||||||||||||
| var body: some View { | ||||||||||||||||||||
| VStack(spacing: 0) { | ||||||||||||||||||||
| HStack(spacing: 0) { | ||||||||||||||||||||
| TypographyText(title, style: .body1_sb_14,color: .gray1000) | ||||||||||||||||||||
| Spacer() | ||||||||||||||||||||
| } | ||||||||||||||||||||
| Spacer() | ||||||||||||||||||||
| .frame(height: 8.adjustedH) | ||||||||||||||||||||
|
Comment on lines
+21
to
+22
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
현재 ♻️ 제안 코드- VStack(spacing: 0) {
+ VStack(spacing: 8.adjustedH) {
HStack(spacing: 0) {
TypographyText("나이", style: .body1_sb_14,color: .gray1000)
Spacer()
}
- Spacer()
- .frame(height: 8.adjustedH)
AgeTextField(text: $text, placeholder: placeholder)
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
| CherrishTextField(text: $text, style: .plain(placeholder: placeholder)) | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| // | ||
| // DateTextBox.swift | ||
| // Cherrish-iOS | ||
| // | ||
| // Created by 어재선 on 1/13/26. | ||
| // | ||
|
|
||
| import SwiftUI | ||
|
|
||
| struct DateTextBox: View { | ||
| @Binding var year: String | ||
| @Binding var month: String | ||
| @Binding var day: String | ||
|
|
||
| var body: some View { | ||
| VStack(spacing: 8) { | ||
| HStack(spacing: 0) { | ||
| TypographyText("날짜", style: .body1_sb_14, color: .gray1000) | ||
| Spacer() | ||
| } | ||
| HStack{ | ||
| DateLabel(text: $year, placeholderStyle: .year) | ||
| DateLabel(text: $month, placeholderStyle: .month) | ||
| DateLabel(text: $day, placeholderStyle: .day) | ||
| } | ||
|
Comment on lines
+21
to
+25
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 HStack spacing 명시적 지정 권장 Line 19의 🤖 Prompt for AI Agents |
||
| } | ||
| } | ||
| } | ||
|
|
||
| private struct DateLabel: View { | ||
| @Binding var text: String | ||
| let placeholderStyle: DateTextFieldStyle | ||
| var body: some View { | ||
| HStack { | ||
| CherrishTextField( | ||
| text: $text, | ||
| style: .date( | ||
| placeholder: placeholderStyle | ||
| ) | ||
| ) | ||
| TypographyText( | ||
| placeholderStyle.kr, | ||
| style: .title2_m_16, | ||
| color: .gray700 | ||
| ) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,160 @@ | ||||||||||||||||||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||||||||||||||||||
| // AgeTextField.swift | ||||||||||||||||||||||||||||||||||||||||||
| // Cherrish-iOS | ||||||||||||||||||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||||||||||||||||||
| // Created by 어재선 on 1/13/26. | ||||||||||||||||||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+6
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. 파일 헤더의 파일명과 실제 struct 이름 불일치 헤더에는 🔧 수정 제안 //
-// AgeTextField.swift
+// CherrishTextField.swift
// Cherrish-iOS
//
// Created by 어재선 on 1/13/26.
//📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| import SwiftUI | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| enum CherrishTextFieldStyle { | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| case plain(placeholder: String) | ||||||||||||||||||||||||||||||||||||||||||
| case date(placeholder: DateTextFieldStyle) | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| var placeholder: String { | ||||||||||||||||||||||||||||||||||||||||||
| switch self { | ||||||||||||||||||||||||||||||||||||||||||
| case .plain(placeholder: let placeholder): | ||||||||||||||||||||||||||||||||||||||||||
| return placeholder | ||||||||||||||||||||||||||||||||||||||||||
| case .date(placeholder: let placeholder): | ||||||||||||||||||||||||||||||||||||||||||
| return placeholder.rawValue | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| var placeholderFont: Typography { | ||||||||||||||||||||||||||||||||||||||||||
| switch self { | ||||||||||||||||||||||||||||||||||||||||||
| case .plain: | ||||||||||||||||||||||||||||||||||||||||||
| return .body1_r_14 | ||||||||||||||||||||||||||||||||||||||||||
| case .date: | ||||||||||||||||||||||||||||||||||||||||||
| return .title2_r_16 | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| var placeholderColor: Color { | ||||||||||||||||||||||||||||||||||||||||||
| switch self { | ||||||||||||||||||||||||||||||||||||||||||
| case .plain: | ||||||||||||||||||||||||||||||||||||||||||
| return .gray600 | ||||||||||||||||||||||||||||||||||||||||||
| case .date: | ||||||||||||||||||||||||||||||||||||||||||
| return .gray500 | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| var textFont: Typography { | ||||||||||||||||||||||||||||||||||||||||||
| switch self { | ||||||||||||||||||||||||||||||||||||||||||
| case .plain: | ||||||||||||||||||||||||||||||||||||||||||
| return .body1_m_14 | ||||||||||||||||||||||||||||||||||||||||||
| case .date: | ||||||||||||||||||||||||||||||||||||||||||
| return .title2_m_16 | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| var textColor: Color { | ||||||||||||||||||||||||||||||||||||||||||
| switch self { | ||||||||||||||||||||||||||||||||||||||||||
| default: | ||||||||||||||||||||||||||||||||||||||||||
| return .gray1000 | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| var fontHeight: CGFloat { | ||||||||||||||||||||||||||||||||||||||||||
| switch self { | ||||||||||||||||||||||||||||||||||||||||||
| default: | ||||||||||||||||||||||||||||||||||||||||||
| return 24.adjustedH | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+51
to
+63
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
♻️ 제안 코드 var textColor: Color {
- switch self {
- default:
- return .gray1000
- }
+ .gray1000
}
var fontHeight: CGFloat {
- switch self {
- default:
- return 24.adjustedH
- }
+ 24.adjustedH
}향후 스타일별 분기가 필요해지면 다시 switch로 변경하면 됩니다. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| var horizontalPadding: CGFloat { | ||||||||||||||||||||||||||||||||||||||||||
| switch self { | ||||||||||||||||||||||||||||||||||||||||||
| case .plain: | ||||||||||||||||||||||||||||||||||||||||||
| return 16.adjustedW | ||||||||||||||||||||||||||||||||||||||||||
| case .date: | ||||||||||||||||||||||||||||||||||||||||||
| return 18.5.adjustedW | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| var verticalPadding: CGFloat { | ||||||||||||||||||||||||||||||||||||||||||
| switch self { | ||||||||||||||||||||||||||||||||||||||||||
| case .plain: | ||||||||||||||||||||||||||||||||||||||||||
| return 10.adjustedH | ||||||||||||||||||||||||||||||||||||||||||
| case .date: | ||||||||||||||||||||||||||||||||||||||||||
| return 8.adjustedH | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| var backgroundStrokeColor: Color { | ||||||||||||||||||||||||||||||||||||||||||
| switch self { | ||||||||||||||||||||||||||||||||||||||||||
| default: | ||||||||||||||||||||||||||||||||||||||||||
| return .gray500 | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+83
to
+88
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
Lines 51-63과 동일한 패턴으로, ♻️ 수정 제안 var backgroundStrokeColor: Color {
- switch self {
- default:
- return .gray500
- }
+ .gray500
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| var textAlinement: TextAlignment { | ||||||||||||||||||||||||||||||||||||||||||
| switch self { | ||||||||||||||||||||||||||||||||||||||||||
| case .plain: | ||||||||||||||||||||||||||||||||||||||||||
| return .leading | ||||||||||||||||||||||||||||||||||||||||||
| case .date: | ||||||||||||||||||||||||||||||||||||||||||
| return .center | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+90
to
+97
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. 오타 수정 필요: 프로퍼티명에 오타가 있습니다. 🔧 수정 제안- var textAlinement: TextAlignment {
+ var textAlignment: TextAlignment {Line 144도 함께 수정: - .multilineTextAlignment(style.textAlinement)
+ .multilineTextAlignment(style.textAlignment)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| enum DateTextFieldStyle: String { | ||||||||||||||||||||||||||||||||||||||||||
| case year = "YYYY" | ||||||||||||||||||||||||||||||||||||||||||
| case month = "MM" | ||||||||||||||||||||||||||||||||||||||||||
| case day = "DD" | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| var kr: String { | ||||||||||||||||||||||||||||||||||||||||||
| switch self { | ||||||||||||||||||||||||||||||||||||||||||
| case .year: | ||||||||||||||||||||||||||||||||||||||||||
| "년" | ||||||||||||||||||||||||||||||||||||||||||
| case .month: | ||||||||||||||||||||||||||||||||||||||||||
| "월" | ||||||||||||||||||||||||||||||||||||||||||
| case .day: | ||||||||||||||||||||||||||||||||||||||||||
| "일" | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| struct CherrishTextField: View { | ||||||||||||||||||||||||||||||||||||||||||
| @Binding var text: String | ||||||||||||||||||||||||||||||||||||||||||
| let style: CherrishTextFieldStyle | ||||||||||||||||||||||||||||||||||||||||||
| var body: some View { | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| HStack(spacing: 0){ | ||||||||||||||||||||||||||||||||||||||||||
| ZStack { | ||||||||||||||||||||||||||||||||||||||||||
| if text.isEmpty { | ||||||||||||||||||||||||||||||||||||||||||
| HStack{ | ||||||||||||||||||||||||||||||||||||||||||
| switch style { | ||||||||||||||||||||||||||||||||||||||||||
| case .plain: | ||||||||||||||||||||||||||||||||||||||||||
| EmptyView() | ||||||||||||||||||||||||||||||||||||||||||
| case .date: | ||||||||||||||||||||||||||||||||||||||||||
| Spacer() | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| TypographyText( | ||||||||||||||||||||||||||||||||||||||||||
| style.placeholder, | ||||||||||||||||||||||||||||||||||||||||||
| style: style.placeholderFont , | ||||||||||||||||||||||||||||||||||||||||||
| color: style.placeholderColor | ||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||
| Spacer() | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| TextField("" ,text: $text) | ||||||||||||||||||||||||||||||||||||||||||
| .foregroundStyle(style.textColor) | ||||||||||||||||||||||||||||||||||||||||||
| .multilineTextAlignment(style.textAlinement) | ||||||||||||||||||||||||||||||||||||||||||
| .keyboardType(.numberPad) | ||||||||||||||||||||||||||||||||||||||||||
| .typography(style.textFont) | ||||||||||||||||||||||||||||||||||||||||||
| .tint(style.textColor) | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+141
to
+146
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 코드 포맷팅 개선 및 키보드 타입 하드코딩
♻️ 포맷팅 수정 제안- TextField("" ,text: $text)
+ TextField("", text: $text)🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| .frame(height: style.fontHeight) | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| .padding(.horizontal, style.horizontalPadding) | ||||||||||||||||||||||||||||||||||||||||||
| .padding(.vertical, style.verticalPadding) | ||||||||||||||||||||||||||||||||||||||||||
| .background { | ||||||||||||||||||||||||||||||||||||||||||
| RoundedRectangle(cornerRadius: 10) | ||||||||||||||||||||||||||||||||||||||||||
| .stroke(style.backgroundStrokeColor, lineWidth: 1) | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| .frame(height: 44) | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
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.
파일 헤더의 파일명과 실제 struct 이름 불일치
헤더에는
AgeTextBox.swift로 되어 있지만 실제 struct 이름은CherrishTextBox입니다.🔧 수정 제안
📝 Committable suggestion
🤖 Prompt for AI Agents