WIP
This commit is contained in:
@@ -38,41 +38,20 @@ struct AllWorkoutsListView: View {
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
List {
|
||||
ForEach(filteredWorkouts, id:\.name) { workout in
|
||||
Section {
|
||||
VStack {
|
||||
Text(workout.name)
|
||||
.font(.title2)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
Text(workout.description ?? "")
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
|
||||
if let muscles = workout.muscles,
|
||||
muscles.joined(separator: ", ").count > 0{
|
||||
Divider()
|
||||
Text(muscles.joined(separator: ", "))
|
||||
.font(.footnote)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
ScrollView {
|
||||
LazyVStack(spacing: 20) {
|
||||
ForEach(filteredWorkouts, id:\.id) { workout in
|
||||
WorkoutOverviewView(workout: workout)
|
||||
.padding([.leading, .trailing])
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
selectedWorkout(workout)
|
||||
}
|
||||
|
||||
if let equipment = workout.equipment,
|
||||
equipment.joined(separator: ", ").count > 0 {
|
||||
Divider()
|
||||
Text(equipment.joined(separator: ", "))
|
||||
.font(.footnote)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
}
|
||||
}
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
selectedWorkout(workout)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.refreshable {
|
||||
refresh()
|
||||
refresh()
|
||||
}
|
||||
|
||||
TextField("Filter" ,text: $searchString)
|
||||
@@ -81,3 +60,15 @@ struct AllWorkoutsListView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct AllWorkoutsListView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
AllWorkoutsListView(workouts: PreviewData.allWorkouts(),
|
||||
selectedWorkout: { workout in
|
||||
|
||||
},
|
||||
refresh: {
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user