added Fitnetss Activity
Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
9b0287f038
commit
ff99b85819
55
FitnessApp/ActivityCard.swift
Normal file
55
FitnessApp/ActivityCard.swift
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
//
|
||||||
|
// ActivityCard.swift
|
||||||
|
// FitnessApp
|
||||||
|
//
|
||||||
|
// Created by Matt Bruce on 12/20/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct Activity {
|
||||||
|
let id: Int
|
||||||
|
let title: String
|
||||||
|
let subtitle: String
|
||||||
|
let image: String
|
||||||
|
let tintColor: Color
|
||||||
|
let amount: String
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ActivityCard: View {
|
||||||
|
@State var activity: Activity
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
ZStack {
|
||||||
|
Color(uiColor: .systemGray6).cornerRadius(15)
|
||||||
|
|
||||||
|
VStack {
|
||||||
|
HStack(alignment: .top) {
|
||||||
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
|
Text(activity.title)
|
||||||
|
Text(activity.subtitle).font(.caption)
|
||||||
|
}
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
Image(systemName: activity.image)
|
||||||
|
.foregroundColor(activity.tintColor)
|
||||||
|
}
|
||||||
|
|
||||||
|
Text(activity.amount)
|
||||||
|
.font(.title)
|
||||||
|
.bold()
|
||||||
|
.padding()
|
||||||
|
}
|
||||||
|
.padding()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview {
|
||||||
|
ActivityCard(activity: .init(id: 1,
|
||||||
|
title: "Test",
|
||||||
|
subtitle: "Goal 10,000",
|
||||||
|
image: "walk",
|
||||||
|
tintColor: .green,
|
||||||
|
amount: "9,000"))
|
||||||
|
}
|
||||||
@ -12,9 +12,16 @@ struct HomeView: View {
|
|||||||
@State var active: Int = 205
|
@State var active: Int = 205
|
||||||
@State var stand: Int = 80
|
@State var stand: Int = 80
|
||||||
|
|
||||||
|
var mockActivities = [
|
||||||
|
Activity(id: 0, title: "Today Steps", subtitle: "10,000 steps", image: "figure.walk", tintColor: .green, amount: "9,812"),
|
||||||
|
Activity(id: 1, title: "Today Steps", subtitle: "1,000 steps", image: "figure.walk", tintColor: .blue, amount: "812"),
|
||||||
|
Activity(id: 2, title: "Today Steps", subtitle: "12,000 steps", image: "figure.walk", tintColor: .purple, amount: "9,0000"),
|
||||||
|
Activity(id: 3, title: "Today Steps", subtitle: "50,000 steps", image: "figure.run", tintColor: .red, amount: "104,812")
|
||||||
|
]
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ScrollView(showsIndicators: false) {
|
ScrollView(showsIndicators: false) {
|
||||||
VStack {
|
VStack(alignment: .leading) {
|
||||||
Text("Wecome")
|
Text("Wecome")
|
||||||
.font(.largeTitle)
|
.font(.largeTitle)
|
||||||
.padding()
|
.padding()
|
||||||
@ -71,6 +78,31 @@ struct HomeView: View {
|
|||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
.padding()
|
.padding()
|
||||||
|
|
||||||
|
//Fitness Activity
|
||||||
|
HStack {
|
||||||
|
Text("Fitness Activity")
|
||||||
|
.font(.title2)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
Button {
|
||||||
|
print("Show More")
|
||||||
|
} label: {
|
||||||
|
Text("Show More")
|
||||||
|
.padding(.all, 10)
|
||||||
|
.foregroundColor(.white)
|
||||||
|
.background(.blue)
|
||||||
|
.cornerRadius(20)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LazyVGrid(columns: Array(repeating: GridItem(spacing: 20), count: 2)) {
|
||||||
|
ForEach(mockActivities, id: \.id) { activity in
|
||||||
|
ActivityCard(activity: activity)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user