Created basic main view, dates missing
This commit is contained in:
@@ -10,20 +10,29 @@ import SwiftUI
|
||||
struct MainView: View {
|
||||
var model = TrashModelView()
|
||||
var body: some View {
|
||||
VStack {
|
||||
ForEach(model.getTrashEvents()) { trashEvent in
|
||||
HStack {
|
||||
Image(systemName: trashEvent.trash.image)
|
||||
.imageScale(.large)
|
||||
.foregroundStyle(.tint)
|
||||
VStack {
|
||||
Text(trashEvent.trash.type)
|
||||
Text(trashEvent.date.ISO8601Format())
|
||||
}
|
||||
GeometryReader { geometry in
|
||||
VStack {
|
||||
CalendarView(events: model.getTrashEvents())
|
||||
.padding()
|
||||
let width: CGFloat = geometry.size.width / 2
|
||||
LazyVGrid(columns: [adaptiveGridItem(width: width)], spacing: 0) {
|
||||
DayView(image: "tree", dayOfTheWeek: "Mon", date: 31, color: .green)
|
||||
.padding()
|
||||
DayView(image: "newspaper", dayOfTheWeek: "Tue", date: 31, color: .blue)
|
||||
.padding()
|
||||
DayView(image: "waterbottle", dayOfTheWeek: "Wed", date: 31, color: .orange)
|
||||
.padding()
|
||||
DayView(image: "trash", dayOfTheWeek: "Thu", date: 31, color: .gray)
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
|
||||
private func adaptiveGridItem(width: CGFloat) -> GridItem {
|
||||
var gridItem = GridItem(.adaptive(minimum: width))
|
||||
gridItem.spacing = 0
|
||||
return gridItem
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user