reorganize content view

This commit is contained in:
Trey t
2022-01-26 10:07:27 -06:00
parent 389a7f7751
commit 6c96602bff

View File

@@ -183,6 +183,28 @@ struct ContentView: View {
}
}
private var headerView: some View {
VStack {
if viewModel.shouldShowVotingHeader() {
AddMoodHeaderView(addItemHeaderClosure: { (mood, date) in
withAnimation {
viewModel.add(mood: mood, forDate: date)
}
})
.frame(height: 180)
.frame(minWidth: 0, maxWidth: .infinity)
} else {
HeaderStatsView(fakeData: false, backDays: 30)
.frame(height: 180)
// should match backDays above
Text(String(format: String(localized: "content_view_header_title"), 30))
.font(.body)
.foregroundColor(Color(UIColor.systemGray))
.frame(maxWidth: .infinity, alignment: .center)
}
}
}
private var mainView: some View {
ZStack {
@@ -190,27 +212,12 @@ struct ContentView: View {
VStack{
settingsButtonView
if viewModel.shouldShowVotingHeader() {
AddMoodHeaderView(addItemHeaderClosure: { (mood, date) in
withAnimation {
viewModel.add(mood: mood, forDate: date)
}
})
.frame(height: 180)
.frame(minWidth: 0, maxWidth: .infinity)
} else {
HeaderStatsView(fakeData: false, backDays: 30)
.frame(height: 180)
// should match backDays above
Text(String(format: String(localized: "content_view_header_title"), 30))
.font(.body)
.foregroundColor(Color(UIColor.systemGray))
.frame(maxWidth: .infinity, alignment: .center)
}
headerView
listView
.padding(.bottom)
}
.padding(.top, 50)
.padding(.bottom)
}
}
}