create tapable header that will switch between bar chart and percentage

WIP - add secondary header for 7 days

closed #21
This commit is contained in:
Trey t
2022-01-30 10:56:33 -06:00
parent 0d33aabb22
commit c77eecc6e2
6 changed files with 207 additions and 62 deletions

View File

@@ -250,14 +250,23 @@ struct ContentView: View {
.frame(height: headerHeight)
.frame(minWidth: 0, maxWidth: .infinity)
} else {
HeaderStatsView(fakeData: false, backDays: 30)
.frame(height: headerHeight)
// 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)
TabView {
SwitchableView(daysBack: 30)
.frame(height: headerHeight)
.frame(minWidth: 0, maxWidth: .infinity)
.contentShape(Rectangle())
SwitchableView(daysBack: 7)
.frame(height: headerHeight)
.frame(minWidth: 0, maxWidth: .infinity)
.contentShape(Rectangle())
}
.tabViewStyle(.page)
.onAppear {
UIPageControl.appearance().currentPageIndicatorTintColor = UIColor.label
UIPageControl.appearance().pageIndicatorTintColor = UIColor.black.withAlphaComponent(0.2)
}
.padding(.bottom, 12)
}
}
}
@@ -305,7 +314,13 @@ struct ContentView: View {
VStack {
SmallRollUpHeaderView(fakeData: false, backDays: 30)
.padding([.leading, .trailing])
.background(
Color(UIColor.systemBackground)
)
.clipShape(RoundedRectangle(cornerRadius: 25, style: .continuous))
.padding()
.padding([.top, .bottom], 5)
Spacer()
}
.opacity(1 - headerOpacity)