Release 1.0.0 baseline
This commit is contained in:
@@ -44,7 +44,7 @@ struct WeekCalendarView: View {
|
||||
ForEach(Array(days.enumerated()), id: \.element) { index, day in
|
||||
dayHeaderCell(day: day, width: 96, height: 24)
|
||||
if index < days.count - 1 {
|
||||
calendarDivider
|
||||
calendarDivider()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ struct WeekCalendarView: View {
|
||||
draggableSlotView(slot: slot, mealType: mealType)
|
||||
.frame(width: 96)
|
||||
if index < days.count - 1 {
|
||||
calendarDivider
|
||||
calendarDivider()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,16 +78,25 @@ struct WeekCalendarView: View {
|
||||
let dayCount = CGFloat(dayRange.count)
|
||||
let spacing: CGFloat = 10
|
||||
let rowLabelWidth: CGFloat = 86
|
||||
let headerHeight: CGFloat = 26
|
||||
let slotRowHeight: CGFloat = 96
|
||||
let verticalInset: CGFloat = 2
|
||||
let contentWidth = proxy.size.width - rowLabelWidth - (dayCount * spacing)
|
||||
let dayWidth = max(92, contentWidth / max(dayCount, 1))
|
||||
let totalHeight =
|
||||
(verticalInset * 2) +
|
||||
headerHeight +
|
||||
1 +
|
||||
(CGFloat(mealTypes.count) * slotRowHeight) +
|
||||
CGFloat(max(0, mealTypes.count - 1))
|
||||
|
||||
VStack(spacing: 0) {
|
||||
HStack(spacing: 0) {
|
||||
Color.clear.frame(width: rowLabelWidth, height: 24)
|
||||
Color.clear.frame(width: rowLabelWidth, height: headerHeight)
|
||||
ForEach(Array(days.enumerated()), id: \.element) { index, day in
|
||||
dayHeaderCell(day: day, width: dayWidth, height: 24)
|
||||
dayHeaderCell(day: day, width: dayWidth, height: headerHeight)
|
||||
if index < days.count - 1 {
|
||||
calendarDivider
|
||||
calendarDivider(height: headerHeight)
|
||||
.padding(.horizontal, spacing / 2)
|
||||
}
|
||||
}
|
||||
@@ -98,15 +107,15 @@ struct WeekCalendarView: View {
|
||||
ForEach(Array(mealTypes.enumerated()), id: \.element) { rowIndex, mealType in
|
||||
HStack(spacing: 0) {
|
||||
mealTypeLabel(mealType)
|
||||
.frame(width: rowLabelWidth)
|
||||
.frame(width: rowLabelWidth, height: slotRowHeight)
|
||||
.padding(.trailing, spacing)
|
||||
|
||||
ForEach(Array(days.enumerated()), id: \.element) { index, day in
|
||||
let slot = slotFor(day: day, mealType: mealType)
|
||||
draggableSlotView(slot: slot, mealType: mealType)
|
||||
.frame(width: dayWidth)
|
||||
.frame(width: dayWidth, height: slotRowHeight)
|
||||
if index < days.count - 1 {
|
||||
calendarDivider
|
||||
calendarDivider(height: slotRowHeight)
|
||||
.padding(.horizontal, spacing / 2)
|
||||
}
|
||||
}
|
||||
@@ -118,15 +127,17 @@ struct WeekCalendarView: View {
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 16)
|
||||
.padding(.vertical, 6)
|
||||
.padding(.vertical, verticalInset)
|
||||
.frame(height: totalHeight, alignment: .top)
|
||||
}
|
||||
.frame(minHeight: CGFloat(mealTypes.count) * 142 + 54)
|
||||
.frame(height: CGFloat(mealTypes.count) * 98 + 44)
|
||||
}
|
||||
|
||||
private var calendarDivider: some View {
|
||||
private func calendarDivider(height: CGFloat? = nil) -> some View {
|
||||
Rectangle()
|
||||
.fill(Color.mealMoodTextSecondary.opacity(0.22))
|
||||
.frame(width: 1)
|
||||
.frame(height: height)
|
||||
}
|
||||
|
||||
private var calendarHorizontalDivider: some View {
|
||||
|
||||
Reference in New Issue
Block a user