diff --git a/Modules/RobotKit/Examples/RobotKitExample/Sources/UI/Buttons.swift b/Modules/RobotKit/Examples/RobotKitExample/Sources/UI/Buttons.swift index 9e962d53cd..9fafb82d76 100644 --- a/Modules/RobotKit/Examples/RobotKitExample/Sources/UI/Buttons.swift +++ b/Modules/RobotKit/Examples/RobotKitExample/Sources/UI/Buttons.swift @@ -4,20 +4,6 @@ import SwiftUI -struct RobotControlStopButton: View { - var body: some View { - Button { - print("STOP ROBOT") - // TODO(@ladislas): Add command - } label: { - Image(systemName: "exclamationmark.octagon.fill") - Text("STOP") - .bold() - } - .buttonStyle(.robotControlPlainButtonStyle(foreground: .white, background: .red)) - } -} - struct RobotControlActionButton: View { private let title: String @@ -34,7 +20,6 @@ struct RobotControlActionButton: View { var body: some View { Button { - print(title) action() } label: { Image(systemName: image) @@ -44,3 +29,11 @@ struct RobotControlActionButton: View { } } + +#Preview { + VStack { + RobotControlActionButton(title: "Say hello", image: "ellipsis.message", tint: .teal) { + print("Hello!") + } + } +} diff --git a/Modules/RobotKit/Examples/RobotKitExample/Sources/Views/RobotControlView.swift b/Modules/RobotKit/Examples/RobotKitExample/Sources/Views/RobotControlView.swift index c0b7e0c8b2..23b95942e1 100644 --- a/Modules/RobotKit/Examples/RobotKitExample/Sources/Views/RobotControlView.swift +++ b/Modules/RobotKit/Examples/RobotKitExample/Sources/Views/RobotControlView.swift @@ -93,11 +93,23 @@ struct RobotControlView: View { .navigationTitle("Robot Control") .toolbar { ToolbarItemGroup(placement: .topBarTrailing) { - RobotControlStopButton() + stopButton } } } + var stopButton: some View { + Button { + print("STOP ROBOT") + // TODO(@ladislas): Add command + } label: { + Image(systemName: "exclamationmark.octagon.fill") + Text("STOP") + .bold() + } + .buttonStyle(.robotControlPlainButtonStyle(foreground: .white, background: .red)) + } + } #Preview {