Skip to content

Commit 4dddef4

Browse files
add faded style for input fields
1 parent 8efeeca commit 4dddef4

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

Examples/DemosApp/DemosApp/ComponentsPreview/PreviewPages/InputFieldPreview.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ struct InputFieldPreview: View {
6464
Picker("Style", selection: self.$model.style) {
6565
Text("Light").tag(InputFieldVM.Style.light)
6666
Text("Bordered").tag(InputFieldVM.Style.bordered)
67+
Text("Faded").tag(InputFieldVM.Style.faded)
6768
}
6869
SubmitTypePicker(selection: self.$model.submitType)
6970
UniversalColorPicker(
@@ -99,7 +100,7 @@ struct InputFieldPreview: View {
99100

100101
private static let title = "Email"
101102
private static let placeholder = "Enter your email"
102-
private static let caption = "We'll send you a verification code"
103+
private static let caption = "Your email address will be used to send a verification code"
103104
private static var initialModel: InputFieldVM {
104105
return .init {
105106
$0.title = Self.title
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
import Foundation
22

33
extension InputFieldVM {
4+
/// The input fields appearance style.
45
public enum Style: Hashable {
6+
/// An input field with a partially transparent background.
57
case light
8+
/// An input field with a transparent background and a border.
69
case bordered
10+
/// An input field with a partially transparent background and a border.
11+
case faded
712
}
813
}

Sources/ComponentsKit/Components/InputField/Models/InputFieldVM.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ extension InputFieldVM {
151151
}
152152
var backgroundColor: UniversalColor {
153153
switch self.style {
154-
case .light:
154+
case .light, .faded:
155155
return self.color?.background ?? .content1
156156
case .bordered:
157157
return .background
@@ -174,7 +174,7 @@ extension InputFieldVM {
174174
switch self.style {
175175
case .light:
176176
return 0
177-
case .bordered:
177+
case .bordered, .faded:
178178
switch self.size {
179179
case .small:
180180
return BorderWidth.small.value

Sources/ComponentsKit/Components/InputField/UKInputField.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ extension UKInputField {
257257
label.isVisible = model.caption.isNotNilAndEmpty
258258
label.textColor = model.captionColor.uiColor
259259
label.font = model.preferredCaptionFont.uiFont
260+
label.numberOfLines = 0
260261
}
261262
static func horizontalStackView(
262263
_ stackView: UIStackView,

0 commit comments

Comments
 (0)