feat: Reimplements reset button style.
This commit is contained in:
@@ -14,16 +14,14 @@ public struct InfoButton: View {
|
||||
Button(action: action) {
|
||||
Label("Info", systemImage: "info.circle")
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.labelStyle(.iconOnly)
|
||||
.font(.title2)
|
||||
.foregroundStyle(Color.accentColor)
|
||||
// .buttonStyle(infoButtonStyle)
|
||||
.buttonStyle(infoButtonStyle)
|
||||
}
|
||||
}
|
||||
|
||||
public struct ResetButton: View {
|
||||
|
||||
@Environment(\.resetButtonStyle) private var resetButtonStyle
|
||||
|
||||
let action: () -> Void
|
||||
|
||||
public init(action: @escaping () -> Void) {
|
||||
@@ -34,13 +32,30 @@ public struct ResetButton: View {
|
||||
Button("Reset", role: .destructive) {
|
||||
action()
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
.buttonStyle(resetButtonStyle)
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
struct ButtonPreview: View {
|
||||
|
||||
@State private var lastButtonPressed: String = ""
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
Text(lastButtonPressed)
|
||||
|
||||
InfoButton {
|
||||
lastButtonPressed = "Info button pressed."
|
||||
}
|
||||
ResetButton {
|
||||
lastButtonPressed = "Reset button pressed."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
VStack {
|
||||
InfoButton { }
|
||||
ResetButton { }
|
||||
}
|
||||
ButtonPreview()
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user