From a09eccad214a97827f9e90c7619ce5c046d61ac5 Mon Sep 17 00:00:00 2001 From: hryeong66 Date: Fri, 20 Sep 2024 18:23:21 +0900 Subject: [PATCH] =?UTF-8?q?Feat:=20RequiredInputTextFieldView=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80(#76)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Projects/Features/MemeEditor/Project.swift | 30 ++++++ .../Features/MemeEditor/Resources/dummy.swift | 1 + .../MemeEditor/Sources/RegisterMemeView.swift | 18 ++++ .../Sources/RequiredInputTextFieldView.swift | 87 ++++++++++++++++++ Projects/Features/MyPage/Project.swift | 1 + .../Star_Marker.imageset/Contents.json | 23 +++++ .../Star_Marker.imageset/Star_Marker.png | Bin 0 -> 334 bytes .../Star_Marker.imageset/Star_Marker@2x.png | Bin 0 -> 525 bytes .../Star_Marker.imageset/Star_Marker@3x.png | Bin 0 -> 743 bytes .../TargetDependency+.swift | 1 + 10 files changed, 161 insertions(+) create mode 100644 Projects/Features/MemeEditor/Project.swift create mode 100644 Projects/Features/MemeEditor/Resources/dummy.swift create mode 100644 Projects/Features/MemeEditor/Sources/RegisterMemeView.swift create mode 100644 Projects/Features/MemeEditor/Sources/RequiredInputTextFieldView.swift create mode 100644 Projects/ResourceKit/Resources/Icon.xcassets/Star_Marker.imageset/Contents.json create mode 100644 Projects/ResourceKit/Resources/Icon.xcassets/Star_Marker.imageset/Star_Marker.png create mode 100644 Projects/ResourceKit/Resources/Icon.xcassets/Star_Marker.imageset/Star_Marker@2x.png create mode 100644 Projects/ResourceKit/Resources/Icon.xcassets/Star_Marker.imageset/Star_Marker@3x.png diff --git a/Projects/Features/MemeEditor/Project.swift b/Projects/Features/MemeEditor/Project.swift new file mode 100644 index 0000000..26b0ec3 --- /dev/null +++ b/Projects/Features/MemeEditor/Project.swift @@ -0,0 +1,30 @@ +// +// Project.swift +// MemeEditor +// +// Created by hyeryeong on 9/20/24 +// + +import ProjectDescription +import ProjectDescriptionHelpers + +let project = Project( + name: "MemeEditor", + targets: [ + .configure( + name: "MemeEditor", + product: .framework, + infoPlist: .default, + sources: "Sources/**", + resources: "Resources/**", + dependencies: [ + .ThirdParty.Dependency, + .ResourceKit, + .Core.DesignSystem, + .Core.PPACModels, + .Core.PPACAnalytics + ] + ) + ] +) + diff --git a/Projects/Features/MemeEditor/Resources/dummy.swift b/Projects/Features/MemeEditor/Resources/dummy.swift new file mode 100644 index 0000000..1f7ee25 --- /dev/null +++ b/Projects/Features/MemeEditor/Resources/dummy.swift @@ -0,0 +1 @@ +//더미임미다 diff --git a/Projects/Features/MemeEditor/Sources/RegisterMemeView.swift b/Projects/Features/MemeEditor/Sources/RegisterMemeView.swift new file mode 100644 index 0000000..2e9aa99 --- /dev/null +++ b/Projects/Features/MemeEditor/Sources/RegisterMemeView.swift @@ -0,0 +1,18 @@ +// +// RegisterMemeView.swift +// MemeEditor +// +// Created by 장혜령 on 2024/09/20. +// + +import SwiftUI + +struct RegisterMemeView: View { + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +#Preview { + RegisterMemeView() +} diff --git a/Projects/Features/MemeEditor/Sources/RequiredInputTextFieldView.swift b/Projects/Features/MemeEditor/Sources/RequiredInputTextFieldView.swift new file mode 100644 index 0000000..f110f0c --- /dev/null +++ b/Projects/Features/MemeEditor/Sources/RequiredInputTextFieldView.swift @@ -0,0 +1,87 @@ +// +// RequiredInputTextFieldView.swift +// MemeEditor +// +// Created by 장혜령 on 2024/09/20. +// + +import SwiftUI +import ResourceKit + +struct RequiredInputTextFieldView: View { + let title: String + let placeHolder: String + let limitedTextCount: Int + @State var content: String = "" + + var currentTextCount: Int { + return content.count + } + + var body: some View { + VStack(alignment: .leading) { + titleView + .padding(.bottom, 12) + textFieldView + } + + } + + var titleView: some View { + HStack { + Text(title) + .font(Font.Body.Xlarge.semiBold) + .foregroundStyle(Color.Text.primary) + ResourceKitAsset.Icon.starMarker.swiftUIImage + .resizable() + .frame(width: 12, height: 12) + .padding(.leading, -8) + .padding(.bottom, 10) + } + } + + var textFieldView: some View { + ZStack { + RoundedRectangle(cornerRadius: 10) + .foregroundStyle(Color.Background.assistive) + TextField(placeHolder, text: $content) + .font(Font.Body.Large.medium) + .padding(.leading, 16) + .padding(.top, 14) + } + } + + var textCountView: some View { + HStack(spacing: 2) { + currentTextCountView + Text("/") + Text("") + } + .foregroundStyle(Color.Text.assistive) + .font(Font.Body.Medium.medium) + + } + + var currentTextCountView: some View { + return Text("\(currentTextCount)") + .foregroundStyle(currentTextColor) + } + + var currentTextColor: SwiftUI.Color { + if currentTextCount == 0 { + return Color.Text.assistive + } else if currentTextCount <= limitedTextCount { + return Color.Text.brand + } + return Color.Text.secondary + } + +} + +#Preview { + RequiredInputTextFieldView( + title: "밈의 제목을 작성해주세요", + placeHolder: "예) 무한도전, 핀터레스트", + limitedTextCount: 32 + ) +} diff --git a/Projects/Features/MyPage/Project.swift b/Projects/Features/MyPage/Project.swift index 2a053ac..73c8c36 100644 --- a/Projects/Features/MyPage/Project.swift +++ b/Projects/Features/MyPage/Project.swift @@ -24,6 +24,7 @@ let project = Project( .Core.PPACModels, .Core.PPACAnalytics, .Feature.MemeDetail, + .Feature.MemeEditor, .Feature.Setting ] ) diff --git a/Projects/ResourceKit/Resources/Icon.xcassets/Star_Marker.imageset/Contents.json b/Projects/ResourceKit/Resources/Icon.xcassets/Star_Marker.imageset/Contents.json new file mode 100644 index 0000000..cbe9ee5 --- /dev/null +++ b/Projects/ResourceKit/Resources/Icon.xcassets/Star_Marker.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "Star_Marker.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Star_Marker@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Star_Marker@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Projects/ResourceKit/Resources/Icon.xcassets/Star_Marker.imageset/Star_Marker.png b/Projects/ResourceKit/Resources/Icon.xcassets/Star_Marker.imageset/Star_Marker.png new file mode 100644 index 0000000000000000000000000000000000000000..a1ab533d5341c3001fb311439cee9358517085bd GIT binary patch literal 334 zcmeAS@N?(olHy`uVBq!ia0vp^JRr=$1|-8uW1a&k&H|6fVg?3oVGw3ym^DWND9BhG zNmX2OgdPERg8E*)0d4@@h$oO6ASd8?0&!(^g(slzskoFI*dwr$r!-?y+B6iJ z3hIvkUfN71^Cy{^Bmf)y2GlroWHai|DkT#K%Ti1ml_n7%gspZ|T_CSj+MzChH`5|A z9UxLskzvrKs*}i#eVY(k$>gB8vIF)}=!xGr5^cWw+0wLa@rg-&ynF3u@gNuw)XOad z>_*}kac2);0z~Xx5s-C)4^Qhkkl^)$fe4Bt`vlm-S>KLj>;C1!WX~W6h}cP1L(P~x zG{)^tuDveE%0Z1lO(M92B<3-Ek?7m>ToU73?y$GuK$0_p8~6htvSW0gJ=s?wvfzI( z7a|h7;LAgF4(V~i5ixp9&t=>i=~b0mMd5WIPV5p@ShnbTzR5nfiUhgJi!4jACNC0; zL|?f%GwvXj_~@WbZGA_2LYE?P)`~ z8bJ_!)eum2 zd9pZ%Bg(FhT)nv@O+oaVZ;xbYASW1R^;1q8m=o*n!I7F?wBZ2d;>5l8Em?wl195%b zeRq=c*kQ~c+%g$PQ2_yWp=}}1Fm01fcF?!XA!n>g~|>HLuFH zX~HQS;g}(DTvbN0#7@cJ6aL(+Z?Erq%|2qUDuNfOodYr{XG&xVyryxq%Ii~%M8=5J zF+AX0_FL#~^DnF{$fj**{XqgA?b;c1UYcHb1>{`zJDVRf>ljbu`b>@%*uIKhIdkX! z9(aN#zvl8ix6Fa~r z)G~idhoVz*=9eR>T_DZzhb)~uA5-?F$zlXgcn4(WRZ7W+FvE89*+NRc((vs?-lR^O zS7w^0@S(x$_oHfK8j#a;0MMZ${`!b@gbWe}~R28b|7 z+{ZkG2Rt&Q64^1+e3v5>=^lH|aVuZ$J|dtjS(-M@i706kxr-tLlAaOR7M(H8jT&I$ zZ