Skip to content

Commit

Permalink
Fix form field spacings.
Browse files Browse the repository at this point in the history
  • Loading branch information
PavelHolec committed Mar 21, 2022
1 parent beff6b0 commit 3e4aa30
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
8 changes: 5 additions & 3 deletions Sources/Orbit/Components/InputField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public struct InputField: View {
let suffixAction: () -> Void

public var body: some View {
VStack(alignment: .leading, spacing: 1) {
VStack(alignment: .leading, spacing: .xxSmall) {
FormFieldLabel(label)

InputContent(
Expand All @@ -50,8 +50,10 @@ public struct InputField: View {
}
}

ContentHeightReader(height: $messageHeight.animation(.easeOut(duration: 0.2))) {
FormFieldMessage(message)
if message.isEmpty == false {
ContentHeightReader(height: $messageHeight.animation(.easeOut(duration: 0.2))) {
FormFieldMessage(message)
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Orbit/Components/Select.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public struct Select: View {
let action: () -> Void

public var body: some View {
VStack(alignment: .leading, spacing: 1) {
VStack(alignment: .leading, spacing: .xxSmall) {
FormFieldLabel(label)

SwiftUI.Button(
Expand Down
2 changes: 1 addition & 1 deletion Sources/Orbit/Support/Forms/FormFieldLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public struct FormFieldLabel: View {

public var body: some View {
Text(label, size: .normal, weight: .medium)
.padding(.bottom, .xxSmall)
.padding(.bottom, 1)
}

public init(_ label: String) {
Expand Down
5 changes: 2 additions & 3 deletions Sources/Orbit/Support/Forms/FormFieldMessage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ public struct FormFieldMessage: View {
Icon(message.icon, size: .small, color: message.color)
Text(message.description, color: .custom(message.uiColor))
.alignmentGuide(.firstTextBaseline) { _ in
Text.Size.normal.value * 1.2
Text.Size.small.value * 1.1
}
}
.padding(.top, .xxSmall)
.transition(.opacity.animation(.easeOut(duration: 0.2)))
}
}

public init(_ message: MessageType, spacing: CGFloat = 5) {
public init(_ message: MessageType, spacing: CGFloat = .xxSmall) {
self.message = message
self.spacing = spacing
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Orbit/Support/Views/TagGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public struct TagGroup<TM: TagModel>: View {
private let layout: Layout

public var body: some View {
VStack(alignment: .leading, spacing: 1) {
VStack(alignment: .leading, spacing: .xxSmall) {
if label.isEmpty == false {
FormFieldLabel(label)
}
Expand Down

0 comments on commit 3e4aa30

Please sign in to comment.