|
|
@@ -3,38 +3,39 @@ import SwiftUI |
|
|
|
|
|
|
|
extension MeetupId { |
|
|
|
public struct V: View { |
|
|
|
@StateObject private var cmp: Component |
|
|
|
@StateObject var isJoinAvailable = BusUI.Value(K.isJoinAvailable, false) |
|
|
|
@StateObject var isLoading = BusUI.Value(K.isLoading, false) |
|
|
|
@StateObject var join = BusUI.Button(K.join) |
|
|
|
@StateObject var textField = BusUI.TextField(K.textApp, K.textUI) |
|
|
|
|
|
|
|
public init(_ id: String) { |
|
|
|
// https://stackoverflow.com/a/62636048 |
|
|
|
_cmp = StateObject(wrappedValue: Component(id)) |
|
|
|
public init() { |
|
|
|
} |
|
|
|
|
|
|
|
public var body: some View { |
|
|
|
VStack(spacing: 8) { |
|
|
|
HStack { |
|
|
|
TextField("Binding-3", value: $cmp.textField.v, formatter: BusUI.TextFieldSource()) |
|
|
|
.disabled(cmp.isLoading.v) |
|
|
|
TextField("Binding-3", value: $textField.v, formatter: BusUI.TextFieldSource()) |
|
|
|
.disabled(isLoading.v) |
|
|
|
.padding(8) |
|
|
|
.border( |
|
|
|
!cmp.isLoading.v ? Color.black : Color.gray, |
|
|
|
width: !cmp.isLoading.v ? 2 : 1 |
|
|
|
!isLoading.v ? Color.black : Color.gray, |
|
|
|
width: !isLoading.v ? 2 : 1 |
|
|
|
) |
|
|
|
if cmp.isLoading.v { |
|
|
|
if isLoading.v { |
|
|
|
ProgressView() |
|
|
|
.padding(8) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Button(action: cmp.join.v.send) { |
|
|
|
Button(action: join.v.send) { |
|
|
|
Text("Join") |
|
|
|
.padding(8) |
|
|
|
.border( |
|
|
|
cmp.isJoinAvailable.v ? Color.green : Color.gray, |
|
|
|
width: cmp.isJoinAvailable.v ? 2 : 1 |
|
|
|
isJoinAvailable.v ? Color.green : Color.gray, |
|
|
|
width: isJoinAvailable.v ? 2 : 1 |
|
|
|
) |
|
|
|
} |
|
|
|
.disabled(!cmp.isJoinAvailable.v) |
|
|
|
.disabled(!isJoinAvailable.v) |
|
|
|
} |
|
|
|
.frame(width: 320) |
|
|
|
.padding() |
|
|
|