Skip to content

Commit

Permalink
🔥 (RobotKitExample): Remove RobotControlStopButton
Browse files Browse the repository at this point in the history
- replace by hand made
- add preview to RobotControlActionButton
- remove print from RobotControlActionButton
  • Loading branch information
ladislas committed Oct 10, 2023
1 parent 5c6f938 commit b6fa012
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
23 changes: 8 additions & 15 deletions Modules/RobotKit/Examples/RobotKitExample/Sources/UI/Buttons.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -34,7 +20,6 @@ struct RobotControlActionButton: View {

var body: some View {
Button {
print(title)
action()
} label: {
Image(systemName: image)
Expand All @@ -44,3 +29,11 @@ struct RobotControlActionButton: View {
}

}

#Preview {
VStack {
RobotControlActionButton(title: "Say hello", image: "ellipsis.message", tint: .teal) {
print("Hello!")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit b6fa012

Please sign in to comment.