-
Notifications
You must be signed in to change notification settings - Fork 0
[Style] #187 - 취득예정, 취득완료(수정 및 삭제 포함) 자격증 컴포넌트 #190
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
Open
OneTen19
wants to merge
8
commits into
develop
Choose a base branch
from
style/#187
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+281
−0
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
fb2f6bf
[Setting] #187 - 리퀴드글래스 대응
OneTen19 8ea8ad3
Merge remote-tracking branch 'refs/remotes/origin/develop'
OneTen19 e822eef
Merge remote-tracking branch 'refs/remotes/origin/style/#181'
OneTen19 eed07fe
Merge remote-tracking branch 'refs/remotes/origin/style/#181'
OneTen19 9123e8f
[Feat] #187 - MyCertificationComponent 구현
OneTen19 059eb07
Merge remote-tracking branch 'refs/remotes/origin/develop'
OneTen19 c9586ad
[Chore] #187 - MyCertificationComponent -> MyCertificationItem 으로 네이밍 수정
OneTen19 28f0ab9
[Chore] #187 - ActionConfig -> EditType 으로 네이밍 변경
OneTen19 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,221 @@ | ||
| // | ||
| // MyCertificationItem.swift | ||
| // CERTI-iOS | ||
| // | ||
| // Created by OneTen on 11/23/25. | ||
| // | ||
|
|
||
| import SwiftUI | ||
|
|
||
| struct MyCertificationItem: View { | ||
|
|
||
| enum CertificationType { | ||
| case completed(date: String, score: String?) | ||
| case expected(location: String, time: String) | ||
|
|
||
| var text: String { | ||
| switch self { | ||
| case .completed: return "취득 완료" | ||
| case .expected: return "취득 예정" | ||
| } | ||
| } | ||
|
|
||
| var color: Color { | ||
| switch self { | ||
| case .completed: return .mainblue | ||
| case .expected: return .purpleblue | ||
| } | ||
| } | ||
| } | ||
|
|
||
| enum EditType { | ||
| case viewOnly // 수정, 삭제 ㄴㄴ | ||
| case editable(onEdit: () -> Void, onDelete: () -> Void) // 수정, 삭제 ㅇㅇ | ||
| } | ||
|
|
||
|
|
||
| // MARK: - Properties | ||
|
|
||
| let type: CertificationType | ||
| let title: String | ||
| let category: String | ||
| let description: String | ||
| let actionConfig: EditType | ||
|
|
||
|
|
||
| // MARK: - Main Body | ||
|
|
||
| var body: some View { | ||
| VStack(alignment: .leading, spacing: 0) { | ||
|
|
||
| topBadge | ||
| .padding(.bottom, 8) | ||
|
|
||
| titleSection | ||
| .padding(.bottom, 4) | ||
|
|
||
| Text(description) | ||
| .applyCertiFont(.caption_regular_12) | ||
| .foregroundStyle(.grayscale500) | ||
| .frame(height: 18) | ||
| .padding(.bottom, 12) | ||
|
|
||
| infoSection | ||
|
|
||
| } | ||
| .padding(16) | ||
| .background(.white) | ||
| .clipShape(RoundedRectangle(cornerRadius: 12)) | ||
| .overlay( | ||
| RoundedRectangle(cornerRadius: 12) | ||
| .stroke(.lightpurple, lineWidth: 1) | ||
| ) | ||
| } | ||
| } | ||
|
|
||
|
|
||
| // MARK: - Subviews | ||
|
|
||
| extension MyCertificationItem { | ||
| @ViewBuilder | ||
| private var topBadge: some View { | ||
| HStack(alignment: .center, spacing: 0) { | ||
| HStack(alignment: .center, spacing: 4) { | ||
| Image(systemName: "checkmark.circle.fill") | ||
| .resizable() | ||
| .scaledToFit() | ||
| .frame(width: 10, height: 10) | ||
|
|
||
| Text(type.text) | ||
| .applyCertiFont(.caption_semibold_10) | ||
| } | ||
| .foregroundStyle(.white) | ||
| .padding(6) | ||
| .background(type.color) | ||
| .clipShape(Capsule()) | ||
|
|
||
| Spacer() | ||
|
|
||
| switch actionConfig { | ||
| case .viewOnly: | ||
| EmptyView() | ||
| case .editable(let onEdit, let onDelete): | ||
| HStack(alignment: .center, spacing: 12) { | ||
| actionButton(title: "수정", action: onEdit) | ||
| actionButton(title: "삭제", action: onDelete) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @ViewBuilder | ||
| private var titleSection: some View { | ||
| HStack(alignment: .center, spacing: 8) { | ||
| Text(title) | ||
| .applyCertiFont(.sub_semibold_20) | ||
|
|
||
| Text(category) | ||
| .applyCertiFont(.caption_regular_12) | ||
| } | ||
| .foregroundStyle(.black) | ||
| .frame(height: 26) | ||
| } | ||
|
|
||
| @ViewBuilder | ||
| private var infoSection: some View { | ||
| HStack(alignment: .center, spacing: 8) { | ||
| switch type { | ||
| case .expected(let location, let time): | ||
| // [취득 예정] 장소 + 시간 | ||
| infoItem(icon: .iconPlacemark16, text: location) | ||
| infoItem(icon: .iconTime16, text: time) | ||
|
|
||
| case .completed(let date, let score): | ||
| // [취득 완료] 날짜 + 점수 | ||
| infoItem(icon: .iconDate16, text: date) | ||
| infoItem(icon: .iconLevel16, text: score ?? "취득 점수 -") | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @ViewBuilder | ||
| private func infoItem(icon: UIImage, text: String) -> some View { | ||
| HStack(spacing: 4) { | ||
| Image(uiImage: icon) | ||
| .foregroundStyle(.grayscale300) | ||
|
|
||
| Text(text) | ||
| .applyCertiFont(.caption_regular_14) | ||
| .foregroundStyle(text == "취득 점수 -" ? .grayscale200 : .black) | ||
| } | ||
| } | ||
|
|
||
| @ViewBuilder | ||
| private func actionButton(title: String, action: @escaping () -> Void) -> some View { | ||
| Button { | ||
| action() | ||
| } label: { | ||
| Text(title) | ||
| .applyCertiFont(.caption_regular_12) | ||
| .foregroundStyle(.grayscale600) | ||
| .padding(.horizontal, 12) | ||
| .padding(.vertical, 4) | ||
| .background(.white) | ||
| .overlay( | ||
| Capsule() | ||
| .stroke(.grayscale300, lineWidth: 1) | ||
| ) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #Preview { | ||
| VStack(spacing: 20) { | ||
|
|
||
| // case 1: 취득 예정, 버튼 없음 | ||
| MyCertificationItem( | ||
| type: .expected(location: "고양시", time: "09:00"), | ||
| title: "정보처리기사", | ||
| category: "국가기술자격", | ||
| description: "소프트웨어 개발 관련 자격증...", | ||
| actionConfig: .viewOnly | ||
| ) | ||
|
|
||
| // case 2: 취득 예정, 버튼 있음 | ||
| MyCertificationItem( | ||
| type: .expected(location: "서울시", time: "14:00"), | ||
| title: "정보보안기사", | ||
| category: "국가기술자격", | ||
| description: "보안 관련 자격증...", | ||
| actionConfig: .editable(onEdit: { | ||
| print("수정") | ||
| }, onDelete: { | ||
| print("삭제") | ||
| }) | ||
| ) | ||
|
|
||
| // case 3: 취득 완료, 버튼 없음, 점수 있음 | ||
| MyCertificationItem( | ||
| type: .completed(date: "2023. 11. 23", score: "IM3"), | ||
| title: "OPIC", | ||
| category: "어학", | ||
| description: "영어 말하기 시험...", | ||
| actionConfig: .viewOnly | ||
| ) | ||
|
|
||
| // case 4: 취득 완료, 버튼 있음, 점수 없음 | ||
| MyCertificationItem( | ||
| type: .completed(date: "2023. 11. 23", score: nil), | ||
| title: "OPIC", | ||
| category: "어학", | ||
| description: "영어 말하기 시험...", | ||
| actionConfig: .editable(onEdit: { | ||
| print("수정") | ||
| }, onDelete: { | ||
| print("삭제") | ||
| }) | ||
| ) | ||
| } | ||
| .padding() | ||
| .background(Color.gray.opacity(0.1)) | ||
| } | ||
15 changes: 15 additions & 0 deletions
15
CERTI-iOS/Global/Resources/Assets.xcassets/Image/icon_level_16.imageset/Contents.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "images" : [ | ||
| { | ||
| "filename" : "icon_16_level.svg", | ||
| "idiom" : "universal" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| }, | ||
| "properties" : { | ||
| "preserves-vector-representation" : true | ||
| } | ||
| } |
9 changes: 9 additions & 0 deletions
9
...Global/Resources/Assets.xcassets/Image/icon_level_16.imageset/icon_16_level.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions
15
CERTI-iOS/Global/Resources/Assets.xcassets/Image/icon_placemark_16.imageset/Contents.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "images" : [ | ||
| { | ||
| "filename" : "icon_placemark_16.svg", | ||
| "idiom" : "universal" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| }, | ||
| "properties" : { | ||
| "preserves-vector-representation" : true | ||
| } | ||
| } |
3 changes: 3 additions & 0 deletions
3
...esources/Assets.xcassets/Image/icon_placemark_16.imageset/icon_placemark_16.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions
15
CERTI-iOS/Global/Resources/Assets.xcassets/Image/icon_time_16.imageset/Contents.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "images" : [ | ||
| { | ||
| "filename" : "icon_time_16.svg", | ||
| "idiom" : "universal" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| }, | ||
| "properties" : { | ||
| "preserves-vector-representation" : true | ||
| } | ||
| } |
3 changes: 3 additions & 0 deletions
3
...S/Global/Resources/Assets.xcassets/Image/icon_time_16.imageset/icon_time_16.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
이거슨 왜 SF symbols 사용했나여. 피그마에 흰배경에 파란체크 아이콘이 안 빠져있는 것 같네염
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.
맞어요 피그마에 따로 안 빠져있어서 그냥 SF symbols 사용했습니다..
따로 요청할게유