feat: Adds form style to styleguide.
This commit is contained in:
@@ -321,11 +321,10 @@ public struct EquipmentMeasurementFormView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.applyFormStyle()
|
||||
.bind($focusedField, to: $store.focusedField)
|
||||
.labeledContentStyle(.gridRow)
|
||||
.onAppear { send(.onAppear) }
|
||||
.textLabelStyle(.boldSecondary)
|
||||
.textFieldStyle(.roundedBorder)
|
||||
.toolbar {
|
||||
NextButton { send(.nextButtonTapped) }
|
||||
.nextButtonStyle(.toolbar)
|
||||
|
||||
@@ -222,10 +222,8 @@ public struct EquipmentSettingsFormView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.labelsHidden()
|
||||
.applyFormStyle()
|
||||
.bind($focusedField, to: $store.focusedField)
|
||||
.textLabelStyle(.boldSecondary)
|
||||
.textFieldStyle(.roundedBorder)
|
||||
.sheet(
|
||||
item: $store.scope(
|
||||
state: \.destination?.infoView,
|
||||
|
||||
@@ -173,9 +173,7 @@ public struct EstimationFormView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.labelsHidden()
|
||||
.textLabelStyle(.boldSecondary)
|
||||
.textFieldStyle(.roundedBorder)
|
||||
.applyFormStyle()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -182,16 +182,6 @@ public struct FlaggedMeasurementsList: Sendable {
|
||||
print("No changes found, not generating a new flagged estimation measurement.")
|
||||
return .none
|
||||
}
|
||||
//
|
||||
// let estimationState = form.estimationState
|
||||
// // Check if there's an existing estimation with the same id, and
|
||||
// // check for changes. If no changes, then short circuit and return nothing.
|
||||
// if let id = form.id,
|
||||
// let existingState = state.sharedSettings.flaggedEstimations[id: id]?.estimationState,
|
||||
// existingState.hasChanges(estimationState)
|
||||
// {
|
||||
// return .none
|
||||
// }
|
||||
|
||||
return .receive(action: \.receive) { [sharedSettings = state.sharedSettings] in
|
||||
|
||||
|
||||
@@ -126,6 +126,7 @@ public struct PressureEstimationsView: View {
|
||||
EquipmentMeasurementFormView(store: measurementStore)
|
||||
.navigationTitle("Existing Measurements")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
15
Sources/Styleguide/Styles/FormStyle.swift
Normal file
15
Sources/Styleguide/Styles/FormStyle.swift
Normal file
@@ -0,0 +1,15 @@
|
||||
import SwiftUI
|
||||
|
||||
// Note: This does not work as an actual form style, as it adds toolbars, etc. multiple times, so just using as a modifier.
|
||||
extension View {
|
||||
|
||||
public func applyFormStyle() -> some View {
|
||||
self
|
||||
.labelsHidden()
|
||||
.textLabelStyle(.boldSecondary)
|
||||
.textFieldStyle(.roundedBorder)
|
||||
#if os(macOS)
|
||||
.padding()
|
||||
#endif
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user