From e562c6000d4779b56075816d5eaecd9f3ae9c968 Mon Sep 17 00:00:00 2001 From: yungu0010 Date: Fri, 30 Aug 2024 12:20:16 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]=20#14=20-=20state=EB=A5=BC=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=ED=95=98=EC=97=AC=20=EC=83=81=ED=83=9C=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=EC=97=90=20=EB=94=B0=EB=A5=B8=20stroke=20=EC=83=89?= =?UTF-8?q?=EC=83=81=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Components/PophoryTextField.swift | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/pophory-TCA/pophory-TCA/Global/Assets/Components/PophoryTextField.swift b/pophory-TCA/pophory-TCA/Global/Assets/Components/PophoryTextField.swift index bc1c770..ce34771 100644 --- a/pophory-TCA/pophory-TCA/Global/Assets/Components/PophoryTextField.swift +++ b/pophory-TCA/pophory-TCA/Global/Assets/Components/PophoryTextField.swift @@ -8,13 +8,15 @@ import SwiftUI struct PophoryTextFieldStyle: TextFieldStyle { + @Binding var isEmpty: Bool + func _body(configuration: TextField) -> some View { configuration .padding(EdgeInsets(top: 19, leading: 15, bottom: 18, trailing: 18)) .fontWithLineHeightView(fontType: .text01Medium) .overlay( RoundedRectangle(cornerRadius: 18) - .stroke(.pryPurple, lineWidth: 1.0) + .stroke(isEmpty ? .gray300 : .pryPurple, lineWidth: 1.0) ) .onAppear { UITextField.appearance().clearButtonMode = .whileEditing @@ -23,14 +25,16 @@ struct PophoryTextFieldStyle: TextFieldStyle { } struct PophoryTextField: View { - @State var text = "" + @State private var text: String = "" + let placeholder: String - var body: some View { - TextField("Hi...", text: $text) - .textFieldStyle(PophoryTextFieldStyle()) - } + var body: some View { + TextField(placeholder, text: $text) + .textFieldStyle(PophoryTextFieldStyle(isEmpty: .constant(text.isEmpty)) + ) + } } #Preview { - PophoryTextField() + PophoryTextField(placeholder: "Enter") }