wip
This commit is contained in:
@@ -173,7 +173,7 @@ public struct EquipmentMeasurementForm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate extension Store where State == EquipmentMeasurementForm.State {
|
extension Store where State == EquipmentMeasurementForm.State {
|
||||||
|
|
||||||
func prompt(
|
func prompt(
|
||||||
field: EquipmentMeasurementForm.State.Field
|
field: EquipmentMeasurementForm.State.Field
|
||||||
@@ -271,7 +271,6 @@ public struct EquipmentMeasurementFormView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.navigationTitle("Existing Measurements")
|
|
||||||
.textLabelStyle(.boldSecondary)
|
.textLabelStyle(.boldSecondary)
|
||||||
.textFieldStyle(.roundedBorder)
|
.textFieldStyle(.roundedBorder)
|
||||||
.sheet(
|
.sheet(
|
||||||
|
|||||||
@@ -127,29 +127,31 @@ public struct EquipmentSettingsFormView: View {
|
|||||||
public var body: some View {
|
public var body: some View {
|
||||||
Form {
|
Form {
|
||||||
Section {
|
Section {
|
||||||
|
EquipmentTypePicker(selection: $store.equipmentType)
|
||||||
|
.pickerStyle(.segmented)
|
||||||
EmptyView()
|
EmptyView()
|
||||||
} header: {
|
} header: {
|
||||||
Text("Equipment Type")
|
Text("Equipment Type")
|
||||||
} footer: {
|
|
||||||
EquipmentTypePicker(selection: $store.equipmentType)
|
|
||||||
.pickerStyle(.segmented)
|
|
||||||
}
|
}
|
||||||
|
.listRowBackground(Color.clear)
|
||||||
|
|
||||||
Section {
|
Section {
|
||||||
EmptyView()
|
FanTypePicker(selection: $store.fanType)
|
||||||
|
.pickerStyle(.segmented)
|
||||||
} header: {
|
} header: {
|
||||||
Text("Fan Type")
|
Text("Fan Type")
|
||||||
#if os(macOS)
|
|
||||||
.font(.title2)
|
|
||||||
#endif
|
|
||||||
} footer: {
|
|
||||||
FanTypePicker(selection: $store.fanType)
|
|
||||||
.pickerStyle(.segmented)
|
|
||||||
}
|
}
|
||||||
|
.listRowBackground(Color.clear)
|
||||||
|
|
||||||
Section {
|
Section {
|
||||||
Grid(alignment: .leading, horizontalSpacing: 40) {
|
Grid(alignment: .leading, horizontalSpacing: 40) {
|
||||||
GridRow {
|
GridRow {
|
||||||
TextLabel("Cooling")
|
TextLabel(
|
||||||
|
store.equipmentType == .furnaceAndCoil
|
||||||
|
? "Cooling"
|
||||||
|
: "Capacity"
|
||||||
|
)
|
||||||
|
Spacer()
|
||||||
Picker("Cooling Capcity", selection: $store.coolingCapacity) {
|
Picker("Cooling Capcity", selection: $store.coolingCapacity) {
|
||||||
ForEach(CoolingCapacity.allCases) {
|
ForEach(CoolingCapacity.allCases) {
|
||||||
Text($0.description)
|
Text($0.description)
|
||||||
@@ -167,11 +169,16 @@ public struct EquipmentSettingsFormView: View {
|
|||||||
)
|
)
|
||||||
.focused($focusedField, equals: .heatingCapacity)
|
.focused($focusedField, equals: .heatingCapacity)
|
||||||
.numberPad()
|
.numberPad()
|
||||||
|
.gridCellColumns(2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} header: {
|
} header: {
|
||||||
header("Capacities", infoView: .capacities)
|
if store.equipmentType == .airHandler {
|
||||||
|
EmptyView()
|
||||||
|
} else {
|
||||||
|
Text("Capacities")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Section {
|
Section {
|
||||||
@@ -282,7 +289,6 @@ public struct EquipmentSettingsFormView: View {
|
|||||||
}
|
}
|
||||||
.labelsHidden()
|
.labelsHidden()
|
||||||
.bind($focusedField, to: $store.focusedField)
|
.bind($focusedField, to: $store.focusedField)
|
||||||
.navigationTitle("Equipment Data")
|
|
||||||
.textLabelStyle(.boldSecondary)
|
.textLabelStyle(.boldSecondary)
|
||||||
.textFieldStyle(.roundedBorder)
|
.textFieldStyle(.roundedBorder)
|
||||||
.sheet(
|
.sheet(
|
||||||
|
|||||||
@@ -25,6 +25,11 @@ public struct TextLabel<Content: View>: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension TextLabel where Content == Text {
|
extension TextLabel where Content == Text {
|
||||||
|
|
||||||
|
public init(_ text: LocalizedStringKey) {
|
||||||
|
self.init { Text(text) }
|
||||||
|
}
|
||||||
|
|
||||||
public init<S>(_ text: S) where S: StringProtocol {
|
public init<S>(_ text: S) where S: StringProtocol {
|
||||||
self.init { Text(text) }
|
self.init { Text(text) }
|
||||||
}
|
}
|
||||||
|
|||||||
54
Sources/Styleguide/TextLabeledContent.swift
Normal file
54
Sources/Styleguide/TextLabeledContent.swift
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
public struct TextLabeledContent<Content: View, Label: View>: View {
|
||||||
|
|
||||||
|
@Environment(\.textLabelStyle) var style
|
||||||
|
|
||||||
|
let label: TextLabel<Label>
|
||||||
|
let content: () -> Content
|
||||||
|
|
||||||
|
public init(
|
||||||
|
label: TextLabel<Label>,
|
||||||
|
@ViewBuilder content: @escaping () -> Content
|
||||||
|
) {
|
||||||
|
self.content = content
|
||||||
|
self.label = label
|
||||||
|
}
|
||||||
|
|
||||||
|
public var body: some View {
|
||||||
|
LabeledContent {
|
||||||
|
content()
|
||||||
|
} label: {
|
||||||
|
label
|
||||||
|
.textLabelStyle(style)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension TextLabeledContent where Label == Text {
|
||||||
|
|
||||||
|
public init(
|
||||||
|
_ title: LocalizedStringKey,
|
||||||
|
@ViewBuilder content: @escaping () -> Content
|
||||||
|
) {
|
||||||
|
self.init(
|
||||||
|
label: TextLabel(title),
|
||||||
|
content: content
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
public init<S: StringProtocol>(
|
||||||
|
_ title: S,
|
||||||
|
@ViewBuilder content: @escaping () -> Content
|
||||||
|
) {
|
||||||
|
self.init(
|
||||||
|
label: TextLabel(title),
|
||||||
|
content: content
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview {
|
||||||
|
TextLabeledContent("Label") { Text("Content") }
|
||||||
|
.textLabelStyle(.boldSecondary)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user