44 lines
1.1 KiB
Swift
44 lines
1.1 KiB
Swift
//
|
|
// WorkoutCard.swift
|
|
// FitnessApp
|
|
//
|
|
// Created by Matt Bruce on 12/20/24.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct WorkoutCard: View {
|
|
@State var workout: Workout
|
|
|
|
var body: some View {
|
|
HStack {
|
|
Image(systemName: workout.image)
|
|
.resizable()
|
|
.scaledToFit()
|
|
.frame(width: 48, height: 48)
|
|
.foregroundColor(workout.tintColor)
|
|
.padding()
|
|
.background(.gray.opacity(0.1))
|
|
.cornerRadius(10)
|
|
|
|
VStack (spacing: 16) {
|
|
HStack {
|
|
Text(workout.title).font(.title3).bold()
|
|
Spacer()
|
|
Text(workout.duration)
|
|
}
|
|
|
|
HStack {
|
|
Text(workout.date)
|
|
Spacer()
|
|
Text(workout.calories)
|
|
}
|
|
}
|
|
}.padding(.horizontal)
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
WorkoutCard(workout: .init(title: "Running", image: "figure.run", tintColor: .green, duration: "1 hour", date: "Aug 3", calories: "100 kcal"))
|
|
}
|