@@ -72,20 +72,14 @@ public enum CautionType {
7272}
7373
7474public struct PokitCaution : View {
75- private let image : PokitImage . Character
76- private let titleKey : String
77- private let message : String
75+ private let type : CautionType
7876 private let action : ( ( ) -> Void ) ?
7977
8078 public init (
81- image: PokitImage . Character ,
82- titleKey: String ,
83- message: String ,
79+ type: CautionType ,
8480 action: ( ( ) -> Void ) ? = nil
8581 ) {
86- self . image = image
87- self . titleKey = titleKey
88- self . message = message
82+ self . type = type
8983 self . action = action
9084 }
9185
@@ -94,27 +88,28 @@ public struct PokitCaution: View {
9488 Spacer ( )
9589
9690 VStack ( spacing: 0 ) {
97- Image ( . character( image) )
91+ Image ( . character( type . image) )
9892 . resizable ( )
9993 . aspectRatio ( contentMode: . fill)
10094 . frame ( width: 180 , height: 180 )
10195 . padding ( . bottom, 16 )
10296
103- Text ( titleKey )
97+ Text ( type . title )
10498 . pokitFont ( . title2)
10599 . foregroundStyle ( . pokit( . text( . secondary) ) )
106100 . padding ( . bottom, 8 )
107101
108- Text ( message)
102+ Text ( type . message)
109103 . pokitFont ( . b2( . m) )
110104 . foregroundStyle ( . pokit( . text( . secondary) ) )
111105 . padding ( . bottom, 16 )
112106
113- if let action {
107+ if let action,
108+ let actionTitle = type. actionTitle {
114109 PokitTextButton (
115- " ๋ค์์๋ " ,
116- state: . default ( . secondary) ,
117- size: . small ,
110+ actionTitle ,
111+ state: . stroke ( . secondary) ,
112+ size: . medium ,
118113 shape: . rectangle,
119114 action: action
120115 )
@@ -128,9 +123,7 @@ public struct PokitCaution: View {
128123
129124#Preview {
130125 PokitCaution (
131- image: . empty,
132- titleKey: " ์ ์ฅ๋ ํฌํท์ด ์์ด์! " ,
133- message: " ํฌํท์ ์์ฑํด ๋งํฌ๋ฅผ ์ ์ฅํด๋ณด์ธ์ " ,
126+ type: . ๋ฏธ๋ถ๋ฅ_๋งํฌ์์,
134127 action: { }
135128 )
136129}
0 commit comments