work on share view UI a bit

This commit is contained in:
Trey t
2022-02-17 18:37:04 -06:00
parent 107086b695
commit 43bbaa4546
4 changed files with 55 additions and 31 deletions

View File

@@ -52,7 +52,7 @@ struct AllMoodsTotalTemplate: View, SharingTemplate {
}
entries = entries.sorted(by: {
$0.mood.rawValue > $1.mood.rawValue
$0.percent > $1.percent
})
} else {
fatalError("no data")
@@ -81,33 +81,51 @@ struct AllMoodsTotalTemplate: View, SharingTemplate {
.foregroundColor(mood.color)
}
}
.frame(maxWidth: .infinity, alignment: .center)
.frame(height: 100)
HStack {
ForEach(entries, id: \.mood) { model in
ZStack {
Circle().fill(model.mood.color)
Text("\(model.percent, specifier: "%.0f")%")
.font(.title)
.fontWeight(.bold)
.scaledToFill()
.minimumScaleFactor(0.5)
.lineLimit(1)
.foregroundColor(Color(UIColor.white))
.padding(2)
VStack {
HStack {
ForEach(entries.prefix(2), id: \.mood) { model in
ZStack {
Circle().fill(model.mood.color)
Text("\(model.percent, specifier: "%.0f")%")
.font(.title)
.fontWeight(.bold)
.scaledToFill()
.minimumScaleFactor(0.5)
.lineLimit(1)
.foregroundColor(Color(UIColor.white))
.padding(2)
}
}
.frame(maxWidth: .infinity, alignment: .center)
.frame(height: 100)
}
.frame(maxWidth: .infinity, alignment: .center)
HStack {
ForEach(entries.suffix(3), id: \.mood) { model in
ZStack {
Circle().fill(model.mood.color)
Text("\(model.percent, specifier: "%.0f")%")
.font(.title)
.fontWeight(.bold)
.scaledToFill()
.minimumScaleFactor(0.5)
.lineLimit(1)
.foregroundColor(Color(UIColor.white))
.padding(2)
}
}
}
.frame(maxWidth: .infinity, alignment: .center)
}
.padding(.top, 30)
HStack {
ForEach(entries, id: \.mood) { model in
ZStack {
Circle().fill(model.mood.color)
Text("\(model.total)")
.font(.title)
.fontWeight(.bold)
@@ -117,8 +135,6 @@ struct AllMoodsTotalTemplate: View, SharingTemplate {
.foregroundColor(Color(UIColor.white))
.padding(2)
}
.frame(maxWidth: .infinity, alignment: .center)
.frame(height: 100)
}
}
}
@@ -130,19 +146,20 @@ struct AllMoodsTotalTemplate: View, SharingTemplate {
.font(.title)
.foregroundColor(Color(UIColor.label))
.frame(maxWidth: .infinity, alignment: .center)
.padding(.top, 1)
.padding()
circularViews
.padding([.trailing, .leading, .top])
Spacer()
}
}.padding()
}
var mainView: some View {
VStack {
shareView
Spacer()
.background(Color(UIColor.secondarySystemBackground))
.cornerRadius(10)
HStack(alignment: .center) {
Button(action: {
showSharingTemplate = true