add shape picker for backgrounds
This commit is contained in:
@@ -17,6 +17,8 @@ struct HeaderPercView: View {
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.textColor.rawValue, store: GroupUserDefaults.groupDefaults) private var textColor: Color = .black
|
||||
|
||||
@AppStorage(UserDefaultsStore.Keys.shape.rawValue, store: GroupUserDefaults.groupDefaults) private var shape: BGShape = .circle
|
||||
|
||||
@State private var entries = [MoodMetrics]()
|
||||
let backDays: Int
|
||||
let type: PercViewType
|
||||
@@ -75,23 +77,19 @@ struct HeaderPercView: View {
|
||||
Spacer()
|
||||
HStack {
|
||||
ForEach(entries.prefix(3), id: \.id) { model in
|
||||
Text("\(model.percent, specifier: "%.0f")%")
|
||||
.font(.title2)
|
||||
.fontWeight(.bold)
|
||||
.padding()
|
||||
.background(Circle().fill(moodTint.color(forMood: model.mood)))
|
||||
.frame(maxWidth: .infinity)
|
||||
shape.view(withText: Text("\(model.percent, specifier: "%.0f")%"),
|
||||
bgColor: moodTint.color(forMood: model.mood),
|
||||
textColor: textColor)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
HStack {
|
||||
ForEach(entries.suffix(2), id: \.id) { model in
|
||||
Text("\(model.percent, specifier: "%.0f")%")
|
||||
.font(.title2)
|
||||
.fontWeight(.bold)
|
||||
.padding()
|
||||
.background(Circle().fill(moodTint.color(forMood: model.mood)))
|
||||
.frame(maxWidth: .infinity)
|
||||
shape.view(withText: Text("\(model.percent, specifier: "%.0f")%"),
|
||||
bgColor: moodTint.color(forMood: model.mood),
|
||||
textColor: textColor)
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
|
||||
Reference in New Issue
Block a user