Skip to content

Commit

Permalink
Feat: RequiredInputTextFieldView 추가(#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
hryeong66 committed Sep 20, 2024
1 parent 40ba248 commit a09ecca
Show file tree
Hide file tree
Showing 10 changed files with 161 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Projects/Features/MemeEditor/Project.swift
Original file line number Diff line number Diff line change
@@ -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
]
)
]
)

1 change: 1 addition & 0 deletions Projects/Features/MemeEditor/Resources/dummy.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//더미임미다
18 changes: 18 additions & 0 deletions Projects/Features/MemeEditor/Sources/RegisterMemeView.swift
Original file line number Diff line number Diff line change
@@ -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()
}
Original file line number Diff line number Diff line change
@@ -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
)
}
1 change: 1 addition & 0 deletions Projects/Features/MyPage/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ let project = Project(
.Core.PPACModels,
.Core.PPACAnalytics,
.Feature.MemeDetail,
.Feature.MemeEditor,
.Feature.Setting
]
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Star_Marker.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Tuist/ProjectDescriptionHelpers/TargetDependency+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ extension TargetDependency {
public static let MyPage = project(moduleName: "MyPage")
public static let MemeDetail = project(moduleName: "MemeDetail")
public static let Setting = project(moduleName: "Setting")
public static let MemeEditor = project(moduleName: "MemeEditor")
}

public struct Core {
Expand Down

0 comments on commit a09ecca

Please sign in to comment.