Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion LoopKitUI/Views/ActionButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public struct ActionButtonStyle: ButtonStyle {
private let cornerRadius: CGFloat = 10
private let squidge: CGFloat = 1

@Environment(\.isEnabled) private var isEnabled: Bool

public init(_ style: ButtonType = .primary) {
switch style {
case .primary:
Expand Down Expand Up @@ -51,7 +53,7 @@ public struct ActionButtonStyle: ButtonStyle {
.foregroundColor(fontColor)
.font(.headline)
.frame(maxWidth: .infinity)
.background(backgroundColor)
.background(isEnabled ? backgroundColor : Color(UIColor.lightGray))
.overlay(Color(.secondarySystemBackground).opacity(configuration.isPressed ? 0.35 : 0))
.cornerRadius(cornerRadius)
.padding(configuration.isPressed ? squidge : 0)
Expand Down
27 changes: 2 additions & 25 deletions LoopKitUI/Views/Settings Editors/TherapySettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,13 @@ public struct TherapySettingsView: View {
}

public var body: some View {
switch mode {
case .acceptanceFlow:
content
case .settings:
navigationViewWrappedContent
}
content
}

private var content: some View {
CardList(title: cardListTitle, style: .sectioned(cardListSections), trailer: cardListTrailer)
CardList(title: Text(therapySettingsTitle), style: .sectioned(cardListSections), trailer: cardListTrailer)
}

private var cardListTitle: Text? { mode == .acceptanceFlow ? Text(therapySettingsTitle) : nil }

private var therapySettingsTitle: String {
return LocalizedString("Therapy Settings", comment: "Therapy Settings screen title")
}
Expand Down Expand Up @@ -107,22 +100,6 @@ public struct TherapySettingsView: View {
}
}

private var navigationViewWrappedContent: some View {
NavigationView {
ZStack {
Color(.systemGroupedBackground)
.edgesIgnoringSafeArea(.all)
content
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
dismissButton
}
}
.navigationBarTitle(therapySettingsTitle, displayMode: .large)
}
}
}

private var dismissButton: some View {
Button(action: dismissAction) {
Text(LocalizedString("Done", comment: "Text for dismiss button"))
Expand Down