From e6fd7e3d0a9854ff3f7d2da441fdd74facb1714e Mon Sep 17 00:00:00 2001 From: minhokim Date: Fri, 22 Nov 2024 00:54:22 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20#156=20CautionType=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Components/PokitCaution.swift | 31 +++++++------------ .../DSKit/Sources/Components/PokitList.swift | 6 +--- .../Sources/CategoryDetailView.swift | 6 +--- .../CategorySharing/CategorySharingView.swift | 6 +--- .../Sources/ContentList/ContentListView.swift | 6 +--- .../FeaturePokit/Sources/PokitRootView.swift | 8 ++--- .../Sources/Remind/RemindView.swift | 18 ++--------- .../Sources/Alert/PokitAlertBoxView.swift | 6 +--- 8 files changed, 22 insertions(+), 65 deletions(-) diff --git a/Projects/DSKit/Sources/Components/PokitCaution.swift b/Projects/DSKit/Sources/Components/PokitCaution.swift index a72388a8..fea55d24 100644 --- a/Projects/DSKit/Sources/Components/PokitCaution.swift +++ b/Projects/DSKit/Sources/Components/PokitCaution.swift @@ -72,20 +72,14 @@ public enum CautionType { } public struct PokitCaution: View { - private let image: PokitImage.Character - private let titleKey: String - private let message: String + private let type: CautionType private let action: (() -> Void)? public init( - image: PokitImage.Character, - titleKey: String, - message: String, + type: CautionType, action: (() -> Void)? = nil ) { - self.image = image - self.titleKey = titleKey - self.message = message + self.type = type self.action = action } @@ -94,27 +88,28 @@ public struct PokitCaution: View { Spacer() VStack(spacing: 0) { - Image(.character(image)) + Image(.character(type.image)) .resizable() .aspectRatio(contentMode: .fill) .frame(width: 180, height: 180) .padding(.bottom, 16) - Text(titleKey) + Text(type.title) .pokitFont(.title2) .foregroundStyle(.pokit(.text(.secondary))) .padding(.bottom, 8) - Text(message) + Text(type.message) .pokitFont(.b2(.m)) .foregroundStyle(.pokit(.text(.secondary))) .padding(.bottom, 16) - if let action { + if let action, + let actionTitle = type.actionTitle { PokitTextButton( - "다시시도", - state: .default(.secondary), - size: .small, + actionTitle, + state: .stroke(.secondary), + size: .medium, shape: .rectangle, action: action ) @@ -128,9 +123,7 @@ public struct PokitCaution: View { #Preview { PokitCaution( - image: .empty, - titleKey: "저장된 포킷이 없어요!", - message: "포킷을 생성해 링크를 저장해보세요", + type: .미분류_링크없음, action: {} ) } diff --git a/Projects/DSKit/Sources/Components/PokitList.swift b/Projects/DSKit/Sources/Components/PokitList.swift index 872ea86e..c3ca1b6d 100644 --- a/Projects/DSKit/Sources/Components/PokitList.swift +++ b/Projects/DSKit/Sources/Components/PokitList.swift @@ -30,11 +30,7 @@ public struct PokitList: View { public var body: some View { if list.isEmpty { VStack { - PokitCaution( - image: .empty, - titleKey: "저장된 포킷이 없어요!", - message: "포킷을 생성해 링크를 저장해보세요" - ) + PokitCaution(type: .카테고리없음) Spacer() } diff --git a/Projects/Feature/FeatureCategoryDetail/Sources/CategoryDetailView.swift b/Projects/Feature/FeatureCategoryDetail/Sources/CategoryDetailView.swift index 5a066f7e..50eb73e7 100644 --- a/Projects/Feature/FeatureCategoryDetail/Sources/CategoryDetailView.swift +++ b/Projects/Feature/FeatureCategoryDetail/Sources/CategoryDetailView.swift @@ -140,11 +140,7 @@ private extension CategoryDetailView { if !store.isLoading { if store.contents.isEmpty { VStack { - PokitCaution( - image: .empty, - titleKey: "저장된 링크가 없어요!", - message: "다양한 링크를 한 곳에 저장해보세요" - ) + PokitCaution(type: .링크없음) .padding(.top, 20) Spacer() diff --git a/Projects/Feature/FeatureCategorySharing/Sources/CategorySharing/CategorySharingView.swift b/Projects/Feature/FeatureCategorySharing/Sources/CategorySharing/CategorySharingView.swift index 53e2844f..25b8502c 100644 --- a/Projects/Feature/FeatureCategorySharing/Sources/CategorySharing/CategorySharingView.swift +++ b/Projects/Feature/FeatureCategorySharing/Sources/CategorySharing/CategorySharingView.swift @@ -91,11 +91,7 @@ private extension CategorySharingView { if !store.isLoading { if store.contents.isEmpty { VStack { - PokitCaution( - image: .empty, - titleKey: "저장된 링크가 없어요!", - message: "다양한 링크를 한 곳에 저장해보세요" - ) + PokitCaution(type: .링크없음) .padding(.top, 20) Spacer() diff --git a/Projects/Feature/FeatureContentList/Sources/ContentList/ContentListView.swift b/Projects/Feature/FeatureContentList/Sources/ContentList/ContentListView.swift index e38a4713..b626fad1 100644 --- a/Projects/Feature/FeatureContentList/Sources/ContentList/ContentListView.swift +++ b/Projects/Feature/FeatureContentList/Sources/ContentList/ContentListView.swift @@ -89,11 +89,7 @@ private extension ContentListView { Group { if !store.isLoading { if store.contents.isEmpty { - PokitCaution( - image: .empty, - titleKey: "즐겨찾기 링크가 없어요!", - message: "링크를 즐겨찾기로 관리해보세요" - ) + PokitCaution(type: .즐겨찾기_링크없음) .padding(.top, 100) Spacer() diff --git a/Projects/Feature/FeaturePokit/Sources/PokitRootView.swift b/Projects/Feature/FeaturePokit/Sources/PokitRootView.swift index 912b10fb..482b8afc 100644 --- a/Projects/Feature/FeaturePokit/Sources/PokitRootView.swift +++ b/Projects/Feature/FeaturePokit/Sources/PokitRootView.swift @@ -125,9 +125,7 @@ private extension PokitRootView { if categories.isEmpty { VStack { PokitCaution( - image: .empty, - titleKey: "저장된 포킷이 없어요!", - message: "포킷을 생성해 링크를 저장해보세요" + type: .카테고리없음, ) .padding(.top, 36) @@ -171,9 +169,7 @@ private extension PokitRootView { if store.contents.isEmpty { VStack { PokitCaution( - image: .empty, - titleKey: "저장된 링크가 없어요!", - message: "다양한 링크를 한 곳에 저장해보세요" + type: .미분류_링크없음, ) .padding(.top, 36) diff --git a/Projects/Feature/FeatureRemind/Sources/Remind/RemindView.swift b/Projects/Feature/FeatureRemind/Sources/Remind/RemindView.swift index f4630aa5..98cdf65e 100644 --- a/Projects/Feature/FeatureRemind/Sources/Remind/RemindView.swift +++ b/Projects/Feature/FeatureRemind/Sources/Remind/RemindView.swift @@ -68,11 +68,7 @@ extension RemindView { unreadContents.isEmpty && favoriteContents.isEmpty { VStack { - PokitCaution( - image: .sad, - titleKey: "링크가 부족해요!", - message: "링크를 5개 이상 저장하고 추천을 받아보세요" - ) + PokitCaution(type: .링크부족) .padding(.top, 100) Spacer() @@ -111,11 +107,7 @@ extension RemindView { .padding(.horizontal, 20) if recommendedContents.isEmpty { - PokitCaution( - image: .sad, - titleKey: "링크가 부족해요!", - message: "링크를 5개 이상 저장하고 추천을 받아보세요" - ) + PokitCaution(type: .링크부족) .padding(.top, 24) .padding(.bottom, 32) } else { @@ -293,11 +285,7 @@ extension RemindView { .padding(.bottom, 16) if favoriteContents.isEmpty { - PokitCaution( - image: .empty, - titleKey: "즐겨찾기 링크가 없어요!", - message: "링크를 즐겨찾기로 관리해보세요" - ) + PokitCaution(type: .즐겨찾기_링크없음) .padding(.top, 16) } else { ForEach(favoriteContents, id: \.id) { content in diff --git a/Projects/Feature/FeatureSetting/Sources/Alert/PokitAlertBoxView.swift b/Projects/Feature/FeatureSetting/Sources/Alert/PokitAlertBoxView.swift index c7fff957..f0e1e0ce 100644 --- a/Projects/Feature/FeatureSetting/Sources/Alert/PokitAlertBoxView.swift +++ b/Projects/Feature/FeatureSetting/Sources/Alert/PokitAlertBoxView.swift @@ -29,11 +29,7 @@ public extension PokitAlertBoxView { if let alertContents = store.alertContents { if alertContents.isEmpty { VStack { - PokitCaution( - image: .pooki, - titleKey: "알림이 없어요", - message: "리마인드 알림을 설정하세요" - ) + PokitCaution(type: .알림없음) .padding(.top, 84) Spacer() }