File tree Expand file tree Collapse file tree 3 files changed +20
-15
lines changed
FeatureSetting/Sources/Alert Expand file tree Collapse file tree 3 files changed +20
-15
lines changed Original file line number Diff line number Diff line change @@ -84,9 +84,14 @@ public struct PokitCaution: View {
8484 private let type : CautionType
8585 private let action : ( ( ) -> Void ) ?
8686
87- public init (
87+ public init ( type: CautionType ) {
88+ self . type = type
89+ self . action = nil
90+ }
91+
92+ private init (
8893 type: CautionType ,
89- action: ( ( ) -> Void ) ? = nil
94+ action: ( ( ) -> Void ) ?
9095 ) {
9196 self . type = type
9297 self . action = action
@@ -132,11 +137,15 @@ public struct PokitCaution: View {
132137 . frame ( maxHeight: . infinity)
133138 . padding ( . bottom, 92 )
134139 }
140+
141+ public func onAction( _ action: @escaping ( ) -> Void ) -> Self {
142+ PokitCaution ( type: self . type, action: action)
143+ }
135144}
136145
137146#Preview {
138- PokitCaution (
139- type : . 미분류_링크없음 ,
140- action : { }
141- )
147+ PokitCaution ( type : . 미분류_링크없음 )
148+ . onAction {
149+
150+ }
142151}
Original file line number Diff line number Diff line change @@ -134,10 +134,8 @@ private extension PokitRootView {
134134 var pokitView : some View {
135135 if let categories = store. categories {
136136 if categories. isEmpty {
137- PokitCaution (
138- type: . 카테고리없음,
139- action: { send ( . 포킷추가_버튼_눌렀을때) }
140- )
137+ PokitCaution ( type: . 카테고리없음)
138+ . onAction { send ( . 포킷추가_버튼_눌렀을때) }
141139 } else {
142140 pokitList ( categories)
143141 }
@@ -181,10 +179,8 @@ private extension PokitRootView {
181179 var unclassifiedView : some View {
182180 if !store. isLoading {
183181 if store. contents. isEmpty {
184- PokitCaution (
185- type: . 미분류_링크없음,
186- action: { send ( . 링크추가_버튼_눌렀을때) }
187- )
182+ PokitCaution ( type: . 미분류_링크없음)
183+ . onAction { send ( . 링크추가_버튼_눌렀을때) }
188184 } else {
189185 unclassifiedList
190186 . padding ( . top, 20 )
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ public extension PokitAlertBoxView {
3030 if alertContents. isEmpty {
3131 VStack {
3232 PokitCaution ( type: . 알림없음)
33- . padding ( . top, 84 )
33+ . padding ( . top, 84 )
3434 Spacer ( )
3535 }
3636 } else {
You can’t perform that action at this time.
0 commit comments