HStack {
ForEach(days, id:\.self) { day in
Text(day)
.font(.system(size: 12, weight: .medium))
.frame(maxWidth: .infinity)
}
}
LazyVGrid(columns: Array(repeating: GridItem(.flexible()), count: 7), spacing: 20) {
ForEach(fetchDates()) { value in
ZStack {
if value.day != -1 {
let hasAppts = manager.days.contains(value.date.monthDayYearFormat())
NavigationLink(value: AppRouter.day(date: value.date)) {
Text("\(value.day)")
.foregroundColor(hasAppts ? .blue : .black)
.fontWeight(hasAppts ? .bold : .none)
.background {
ZStack(alignment: .bottom) {
Circle()
.frame(width: 48, height: 48)
.foregroundColor(hasAppts ? .blue.opacity(0.1) : .clear)
if value.date.monthDayYearFormat() == Date().monthDayYearFormat() {
Circle()
.frame(width: 8, height: 8)
.foregroundColor(hasAppts ? .blue : .gray)
}
}
}
}
.disabled(!hasAppts)
} else {
Text("")
}
}
.frame(width: 32, height: 32)
}
}
}
.padding()
}