feat: Adds more buttons and reverse label style
This commit is contained in:
@@ -1,5 +1,20 @@
|
||||
import SwiftUI
|
||||
|
||||
public struct DoneButton: View {
|
||||
|
||||
let action: () -> Void
|
||||
|
||||
public init(action: @escaping () -> Void) {
|
||||
self.action = action
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
Button(action: action) {
|
||||
Text("Done")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public struct InfoButton: View {
|
||||
|
||||
@Environment(\.infoButtonStyle) private var infoButtonStyle
|
||||
@@ -18,6 +33,26 @@ public struct InfoButton: View {
|
||||
}
|
||||
}
|
||||
|
||||
public struct NextButton: View {
|
||||
|
||||
@Environment(\.nextButtonStyle) private var nextButtonStyle
|
||||
|
||||
let action: () -> Void
|
||||
|
||||
public init(action: @escaping () -> Void) {
|
||||
self.action = action
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
Button {
|
||||
action()
|
||||
} label: {
|
||||
Label("Next", systemImage: "chevron.right")
|
||||
}
|
||||
.buttonStyle(nextButtonStyle)
|
||||
}
|
||||
}
|
||||
|
||||
public struct ResetButton: View {
|
||||
|
||||
@Environment(\.resetButtonStyle) private var resetButtonStyle
|
||||
@@ -48,7 +83,10 @@ struct ButtonPreview: View {
|
||||
InfoButton {
|
||||
lastButtonPressed = "Info button pressed."
|
||||
}
|
||||
ResetButton {
|
||||
NextButton {
|
||||
lastButtonPressed = "Next button pressed."
|
||||
}
|
||||
ResetButton {
|
||||
lastButtonPressed = "Reset button pressed."
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user