68 lines
1.4 KiB
Swift
68 lines
1.4 KiB
Swift
//
|
|
// SetListItem.swift
|
|
// WorkoutsPlus
|
|
//
|
|
// Created by Felix Förtsch on 02.09.24.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct SetListItem: View {
|
|
var workout: Workout
|
|
@Binding var set: WorkoutItem
|
|
|
|
var body: some View {
|
|
HStack {
|
|
HStack {
|
|
Text(String(set.plannedReps))
|
|
.font(.system(size: 14, weight: .bold))
|
|
.foregroundStyle(.white)
|
|
.frame(width: 20, height: 10)
|
|
.padding(8)
|
|
.background(Color.blue)
|
|
.clipShape(RoundedRectangle(cornerRadius: 8))
|
|
Image(systemName: "repeat")
|
|
Text("Set")
|
|
}
|
|
.fontWeight(.bold)
|
|
Spacer()
|
|
Stepper(
|
|
value: $set.plannedReps,
|
|
in: 0...100,
|
|
step: 1
|
|
) {}
|
|
Button(action: {
|
|
|
|
}) {
|
|
Image(systemName: "plus.circle.fill")
|
|
.foregroundStyle(.green)
|
|
}
|
|
}
|
|
ForEach(set.set) { workoutItem in
|
|
WorkoutListItem(workout, workoutItem)
|
|
.padding(.leading)
|
|
}
|
|
}
|
|
|
|
private func addExerciseToSet() {
|
|
|
|
}
|
|
}
|
|
|
|
//#Preview {
|
|
// @Previewable @State var set = WorkoutItem(set: [
|
|
// WorkoutItem(Exercise("Squat")),
|
|
// WorkoutItem(Exercise("Squat")),
|
|
// WorkoutItem(Exercise("Squat"))])
|
|
// List {
|
|
// SetListItem(workout: Workout(name: "RR"), set: $set)
|
|
// }
|
|
//}
|
|
//
|
|
//#Preview("Empty Database") {
|
|
// @Previewable @State var set = WorkoutItem(set: [])
|
|
// List {
|
|
// SetListItem(workout: Workout(name: "RR"), set: $set)
|
|
// }
|
|
//}
|