Skip to content

Commit

Permalink
fix: components
Browse files Browse the repository at this point in the history
  • Loading branch information
alsh0807 committed Jul 25, 2024
1 parent 6f2482c commit 0311697
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
10 changes: 8 additions & 2 deletions Sources/SDS/Component/Button/SopoBottomButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@ import SwiftUI
public struct SopoBottomButton: View {
let text: Text
let background: Color
let action: (() -> ())?

public init(_ text: () -> Text, background: Color = .primary(.normal)) {
public init(_ text: () -> Text, background: Color = .primary(.normal), action: (() -> ())?) {
self.text = text()
self.background = background
self.action = action
}

public var body: some View {
Button {} label: {
Button {
if let action = action {
action()
}
} label: {
RoundedRectangle(cornerRadius: 12)
.frame(height: 56)
.padding(.horizontal, 36)
Expand Down
15 changes: 6 additions & 9 deletions Sources/SDS/Component/TextField/SopoTextField.swift
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
import SwiftUI


public struct SopoTextField: View {

@Binding var text: String
let prompt: String
let isSecure: Bool
let inputType: NSTextContentType?
let trailing: AnyView?

public init(text: Binding<String>, prompt: String, isSecure: Bool = false, inputType: NSTextContentType? = .none, trailing: @escaping () -> some View) {
public init(text: Binding<String>, prompt: String, isSecure: Bool = false, trailing: @escaping () -> some View) {
self._text = text
self.prompt = prompt
self.isSecure = isSecure
self.inputType = inputType
self.trailing = AnyView(trailing())
}

public init(text: Binding<String>, prompt: String, isSecure: Bool = false, inputType: NSTextContentType? = .none) {
public init(text: Binding<String>, prompt: String, isSecure: Bool = false) {
self._text = text
self.prompt = prompt
self.isSecure = isSecure
self.inputType = inputType
self.trailing = nil
}

Expand All @@ -40,7 +38,7 @@ public struct SopoTextField: View {
prompt: Text(prompt)
.foregroundColor(.label(.disable))
)

.textContentType(.password)
}
else {
TextField(
Expand All @@ -52,10 +50,9 @@ public struct SopoTextField: View {
}
}
.autocorrectionDisabled()
.textContentType(inputType)
#if os(iOS)
#if os(iOS)
.textInputAutocapitalization(.never)
#endif
#endif
.font(.label(.bold))
.foregroundStyle(Color.label(.normal))

Expand Down

0 comments on commit 0311697

Please sign in to comment.