add shape picker for backgrounds

This commit is contained in:
Trey t
2022-03-20 02:45:51 -05:00
parent d064cdb3d9
commit 36a688084c
14 changed files with 247 additions and 91 deletions

View File

@@ -9,32 +9,22 @@ import Foundation
import SwiftUI
struct DayChartView: ChartViewItemBuildable, View, Hashable {
init(color: Color, weekDay: Int, viewType: ViewType) {
init(color: Color, weekDay: Int, shape: BGShape) {
self.color = color
self.weekDay = weekDay
self.viewType = viewType
self.shape = shape
}
var id = UUID()
var color: Color
var weekDay: Int
var viewType: ViewType
var shape: BGShape
var body: some View {
switch viewType {
case .cicle:
Circle()
.fill(color)
.frame(minWidth: 5, idealWidth: 50, maxWidth: 50, minHeight: 5, idealHeight: 20, maxHeight: 50, alignment: .center)
.opacity(color == Mood.missing.color ? 0.5 : 1.0)
case .square:
Rectangle()
.fill(color)
.frame(minWidth: 5, idealWidth: 50, maxWidth: 50, minHeight: 5, idealHeight: 20, maxHeight: 50, alignment: .center)
case .text(let value):
Text(value)
.font(.footnote)
.frame(minWidth: 5, idealWidth: 50, maxWidth: 50, minHeight: 5, idealHeight: 20, maxHeight: 50, alignment: .center)
}
shape.view(withText: Text(""), bgColor: color, textColor: .clear)
.frame(minWidth: 5, idealWidth: 50, maxWidth: 50,
minHeight: 5, idealHeight: 20, maxHeight: 50,
alignment: .center)
.opacity(color == Mood.missing.color ? 0.5 : 1.0)
}
}