This commit is contained in:
Trey t
2022-02-17 18:05:33 -06:00
parent 7b828cc93c
commit 7dc85eb2f0

View File

@@ -60,7 +60,7 @@ struct SmallRollUpHeaderView: View {
}
}
private var textViews: some View {
private var modelTextViews: some View {
HStack {
ForEach(entries, id: \.0) { model in
textView(forModel: model)
@@ -68,6 +68,31 @@ struct SmallRollUpHeaderView: View {
}
}
private var viewOnViewtype : some View {
HStack {
switch viewType {
case .total, .percentageCircle:
circularViews
case .percentage:
textViews
}
}
}
private var textViews: some View {
HStack {
ForEach(entries, id: \.0) { model in
textView(forModel: model)
.font(.title2)
.fontWeight(.bold)
.lineLimit(1)
.foregroundColor(model.mood.color)
.frame(width: 50, height: 50)
}
}
.padding([.top, .bottom])
}
private var circularViews: some View {
HStack {
ForEach(entries, id: \.0) { model in
@@ -84,22 +109,14 @@ struct SmallRollUpHeaderView: View {
.lineLimit(1)
.foregroundColor(Color(UIColor.white))
}
.padding([.leading, .trailing], 5)
}
}
.padding([.top, .bottom])
}
var body: some View {
VStack {
circularViews
.padding([.trailing, .leading, .top])
Text(String(format: String(localized: "content_view_header_title"), self.backDays))
.font(.body)
.foregroundColor(Color(UIColor.systemGray))
.frame(maxWidth: .infinity, alignment: .center)
.padding(.top, 1)
}
viewOnViewtype
.frame(minWidth: 0, maxWidth: .infinity)
}
}